0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-07-16 16:46:26 +00:00
org-mode/lisp
Carsten Dominik 2b14934fe8 HTML export: Fix linking to targets in external files
Dan Davison writes:

> Bug report
> ==========
> If I have this:
>
> A [[file:zz.org::#mytarget][link]] to a target with a custom ID
>
> and export it to HTML, I get
>
> A <a href="zz.html##mytarget">link</a> to a target with a custom ID
>
> which (in firefox on linux) links to the file but does not jump to the
> target. However, if I change the '##' to '#' then firefox jumps to the
> correct location. Is this an org bug?
>
> Very tentatively proposed patch
> ===============================
> I've investigated a bit (notes below), resulting in this proposed patch:
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/lisp/org-html.el b/lisp/org-html.el
> index aa70408..5ee5b19 100644
> --- a/lisp/org-html.el
> +++ b/lisp/org-html.el
> @@ -1110,7 +1110,7 @@ lang=\"%s\" xml:lang=\"%s\">
>                     (abs-p (file-name-absolute-p filename))
>                     thefile file-is-image-p search)
>                (save-match-data
> -                 (if (string-match "::\\(.*\\)" filename)
> +                 (if (string-match "::#?\\(.*\\)" filename)
>                      (setq search (match-string 1 filename)
>                            filename (replace-match "" t nil filename)))
>                  (setq valid
> --8<---------------cut here---------------end--------------->8---
>
> Doc patch
> =========
> The link above (file:zz.org::#mytarget) was created by C-c l on a
> heading with a CUSTOM_ID property. However, I couldn't see where in the
> manual links of this form are documented. Do we need to add this link
> type to section 4.7 "Search options in file links", e.g.
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/doc/org.texi b/doc/org.texi
> index f49f056..c8cc1a5 100644
> --- a/doc/org.texi
> +++ b/doc/org.texi
> @@ -3116,6 +3116,7 @@ link, together with an explanation:
> [[file:~/code/main.c::255]]
> [[file:~/xx.org::My Target]]
> [[file:~/xx.org::*My Target]]
> +[[file:~/xx.org::#my-custom-id]]
> [[file:~/xx.org::/regexp/]]
> @end example
>
> @@ -3130,6 +3131,8 @@ link will become an HTML reference to the corresponding named anchor in
> the linked file.
> @item *My Target
> In an Org file, restrict search to headlines.
> +@item #my-custom-id
> +Link to a heading with a @code{CUSTOM_ID} property
> @item /regexp/
> Do a regular expression search for @code{regexp}.  This uses the Emacs
> command @code{occur} to list all matches in a separate window.  If the
> --8<---------------cut here---------------end--------------->8---
>
> Notes
> =====
> At line 1134 of org-html.el there is
>
> 			(setq thefile (concat thefile "#"
> 					      (org-solidify-link-text
> 					       (org-link-unescape search)))))
>
> during evaluation of which 'search is bound to "#mytarget", which
> suggested that the problem might be in the regexp parsing creating
> 'search.
2010-03-19 18:04:23 +01:00
..
ChangeLog HTML export: Fix linking to targets in external files 2010-03-19 18:04:23 +01:00
ChangeLog.01 Split ChangeLog file into parts. 2008-05-08 08:16:38 +02:00
org-agenda.el Fix time extraction when inserting diary entries with `i d' 2010-03-18 06:36:49 +01:00
org-archive.el Archiving: Allow to reverse order in target node 2010-03-11 07:23:03 +01:00
org-ascii.el ASCII export: Remove narrowing of columns for export 2010-02-12 18:48:16 +01:00
org-attach.el Remove comma after means in many docstrings 2010-01-21 16:15:40 +01:00
org-bbdb.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-beamer.el beamer: Add custom options to an outline frame. 2010-03-04 21:55:18 +01:00
org-bibtex.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-clock.el Refactor some functions in clocking 2010-03-09 17:10:15 +01:00
org-colview-xemacs.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-colview.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-compat.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-crypt.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-ctags.el Bug fixes in org-ctags.el 2010-01-18 08:21:33 +01:00
org-datetree.el Fix typo 2010-01-23 22:47:47 +01:00
org-docbook.el Docbook exporter: Fix problems with exporting footnotes and empty lines 2010-03-08 19:43:34 +01:00
org-docview.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-exp-blocks.el babel: greatly simplified block exportation 2010-02-09 19:09:19 -07:00
org-exp.el HTML export: Fix problem with table attributes when first table line is special 2010-03-11 12:27:42 +01:00
org-faces.el Implement a simpler way to specify faces for tags and todo keywords 2010-02-25 16:41:28 +01:00
org-feed.el Remove comma after means in many docstrings 2010-01-21 16:15:40 +01:00
org-footnote.el Remove comma after means in many docstrings 2010-01-21 16:15:40 +01:00
org-freemind.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-gnus.el Remove comma after means in many docstrings 2010-01-21 16:15:40 +01:00
org-habit.el Fix habit alignment problems 2010-01-31 17:51:49 +01:00
org-html.el HTML export: Fix linking to targets in external files 2010-03-19 18:04:23 +01:00
org-icalendar.el Remove comma after means in many docstrings 2010-01-21 16:15:40 +01:00
org-id.el Fix bug when there is no hast for id locations 2010-02-26 19:51:15 +01:00
org-indent.el Remove comma after means in many docstrings 2010-01-21 16:15:40 +01:00
org-info.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-inlinetask.el Remove comma after means in many docstrings 2010-01-21 16:15:40 +01:00
org-irc.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-jsinfo.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-latex.el Fix problem with a missing function in XEmacs 2010-03-12 17:29:41 +01:00
org-list.el Fix cursor position after changing bullet types 2010-03-17 16:11:13 +01:00
org-mac-message.el Fix bug with insertion of date lines into a tree from the agenda 2010-02-01 14:30:36 +01:00
org-macs.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-mew.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-mhe.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-mobile.el Remove comma after means in many docstrings 2010-01-21 16:15:40 +01:00
org-mouse.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-plot.el plot: handles option lines starting after column 0 2010-03-01 08:22:18 -07:00
org-protocol.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-publish.el Publishing: Run the after-export-hook 2010-03-04 21:11:08 +01:00
org-remember.el Remember: Allow to file as sibling of current clock 2010-02-24 10:35:28 +01:00
org-rmail.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-src.el Re-install the support for table.el tables again. 2010-02-26 22:33:49 +01:00
org-table.el Tables: Introduce field coordinates for formulas, improve docs 2010-03-14 13:11:17 +01:00
org-timer.el Update org-timer.el so that we only allow one timer. 2010-02-25 16:03:38 +01:00
org-vm.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-w3m.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-wl.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org-xoxo.el Version number to 6.34trans 2010-01-20 10:13:21 +01:00
org.el Refile: Catch invalid target specification 2010-03-19 14:09:30 +01:00