When exporting my project with org-publish, the exporter generates
anchors with names such as "orga79e495" and refers to them when linking
to the headers from other files. However, the generated anchor names
don't match between files, resulting in all links being dead.

Furthermore, the publishing directory is not respected, so all links
still point to the directory that the org file was in, even though the
html files are located elsewhere.

Example:

I have put the files needed to reproduce this at
https://gist.github.com/martinhansdk/f81a5fdf340eab591e6df55645cfd22d
They can be viewed there or fetched with git:

    git clone https://gist.github.com/martinhansdk/
f81a5fdf340eab591e6df55645cfd22d

Run emacs -Q -l minimal-org.el

Then export with M-x org-publish org

I get files in the exported/ subdirectory.

The last link in the clocking table in exported/time.html is

    <a href="file:///home/mrhn/bugreports/orgmode-html/
journal.html#org2f3d7f7">Worked on supporting ä, ö, and ü</a>

But that should have been

    <a href="journal.html#org5c71d1e">Worked on supporting ä, ö, and ü</a>

Note that both the path is absolute where it should have been relative
and the anchor is wrong.

As far as I can tell, both problems stem from the fact that the links in
the clocking table are absolute file system links. This is, however how
the clock table code (org-dblock-update) formats the table. If I
manually transform the links in time.org to manual links, then the HTML
links are no longer dead.


As an aside, is there any way to prevent the following line from
appearing in the exported HTML?

    #+BEGIN: clocktable :scope agenda :link t :maxlevel 5


Thanks,
  Martin


Emacs  : GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-12 on hullmann, modified by Debian
Package: Org mode version 9.1.3 (9.1.3-2-g322612-elpa @
/home/mrhn/.emacs.d/elpa/org-20171120/)

current state:
==============
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-link-file-path-type 'relative
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-latex-format-inlinetask-function 'org-latex-format-inlinetask-
default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-latex-format-headline-function 'org-latex-format-headline-
default-function
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn ## CONTENTS)"]
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
             org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
           [add-hook change-major-mode-hook org-show-block-all append
local] 5
           "\n\n(fn)"]
         #[0 "\300\301\302\303\304$\207"
           [add-hook change-major-mode-hook org-babel-show-result-all append
            local]
           5 "\n\n(fn)"]
         org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-
default-function
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
          org-cycle-show-empty-lines
          org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-html-format-headline-function 'org-html-format-headline-
default-function
 org-link-parameters '(("id" :follow org-id-open)
               ("rmail" :follow org-rmail-open :store org-rmail-store-link)
               ("mhe" :follow org-mhe-open :store org-mhe-store-link)
               ("irc" :follow org-irc-visit :store org-irc-store-link)
               ("info" :follow org-info-open :export org-info-export :store
            org-info-store-link)
               ("gnus" :follow org-gnus-open :store org-gnus-store-link)
               ("docview" :follow org-docview-open :export
org-docview-export
            :store org-docview-store-link)
               ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
               ("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete
            org-bbdb-complete-link :store org-bbdb-store-link)
               ("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs")
               ("doi" :follow org--open-doi-link)
               ("elisp" :follow org--open-elisp-link)
               ("file" :complete org-file-complete-link)
               ("ftp" :follow (lambda (path) (browse-url (concat "ftp:"
path))))
               ("help" :follow org--open-help-link)
               ("http" :follow
            (lambda (path) (browse-url (concat "http:" path))))
               ("https" :follow
            (lambda (path) (browse-url (concat "https:" path))))
               ("mailto" :follow
            (lambda (path) (browse-url (concat "mailto:"; path))))
               ("news" :follow
            (lambda (path) (browse-url (concat "news:"; path))))
               ("shell" :follow org--open-shell-link))
 org-html-format-inlinetask-function 'org-html-format-inlinetask-
default-function
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-publish-project-alist '(("org-notes" :base-directory "."
:base-extension "org"
                  :publishing-directory "exported/" :recursive t
                  :publishing-function org-html-publish-to-html
                  :headline-levels 4 :auto-preamble t)
                 ("org-static" :base-directory "." :base-extension
                  "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
                  :publishing-directory "exported/" :recursive t
                  :publishing-function org-publish-attachment)
                 ("org" :components ("org-notes" "org-static")))
 )

Reply via email to