Browse Source

ox-html: Prefer custom ID over internal references for links to headlines

* lisp/ox-html.el (org-html-link): Use custom ID if present instead of
  internal reference.

Reported-by: Oleh Krehel <ohwoeowho@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/98259>
Nicolas Goaziou 9 years ago
parent
commit
b856f66892
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lisp/ox-html.el

+ 2 - 2
lisp/ox-html.el

@@ -2801,7 +2801,6 @@ images, set it to:
 
 (defun org-html-link (link desc info)
   "Transcode a LINK object from Org to HTML.
-
 DESC is the description part of the link, or the empty string.
 INFO is a plist holding contextual information.  See
 `org-export-data'."
@@ -2908,7 +2907,8 @@ INFO is a plist holding contextual information.  See
 			(org-element-property :raw-link link) info))))
 	  ;; Link points to a headline.
 	  (headline
-	   (let ((href (org-export-get-reference destination info))
+	   (let ((href (or (org-element-property :CUSTOM_ID destination)
+			   (org-export-get-reference destination info)))
 		 ;; What description to use?
 		 (desc
 		  ;; Case 1: Headline is numbered and LINK has no