Browse Source

ox-html: Always resolve external custom-id links

* lisp/ox-html.el (org-html-link): Always resolve external custom-id links.

Suggested-by: Alan Schmitt <alan.schmitt@polytechnique.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/103552>
Nicolas Goaziou 9 years ago
parent
commit
8594aed1d6
1 changed files with 11 additions and 6 deletions
  1. 11 6
      lisp/ox-html.el

+ 11 - 6
lisp/ox-html.el

@@ -2846,12 +2846,17 @@ INFO is a plist holding contextual information.  See
 	    ;; relative to a custom-id, a headline title a name,
 	    ;; a target or a radio-target.
 	    (let ((option (org-element-property :search-option link)))
-	      (if (not option) raw-path
-		(concat raw-path
-			"#"
-			(org-publish-resolve-external-link
-			 option
-			 (org-element-property :path link))))))
+	      (cond ((not option) raw-path)
+		    ;; Since HTML back-end use custom-id value as-is,
+		    ;; resolving is them is trivial.
+		    ((eq (string-to-char option) ?#)
+		     (concat raw-path "#" option))
+		    (t
+		     (concat raw-path
+			     "#"
+			     (org-publish-resolve-external-link
+			      option
+			      (org-element-property :path link)))))))
 	   (t raw-path)))
 	 ;; Extract attributes from parent's paragraph.  HACK: Only do
 	 ;; this for the first link in parent (inner image link for