diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2014-01-01 18:58:26 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2014-01-01 18:58:26 +0100 |
commit | 4d652d21ae1bab3f3fe203320d511193384f3fcb (patch) | |
tree | 67d975ea6c04316bfb03cb68b9b2a5b32e43ebe1 | |
parent | e23bbda0aa99dedff06b8df9e0c865a94df37cd1 (diff) | |
download | org-mode-4d652d21ae1bab3f3fe203320d511193384f3fcb.tar.gz |
ox-html: Change default behaviour for unresolved link options
* lisp/ox-html.el (org-html-link): When an option cannot be resolved,
append a hash sign as it could point to a target, instead of
ignoring it.
-rw-r--r-- | lisp/ox-html.el | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 38988ed..c376717 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2678,23 +2678,21 @@ INFO is a plist holding contextual information. See ((and home use-abs-url) (setq raw-path (concat (file-name-as-directory home) raw-path)))) ;; Add search option, if any. A search option can be - ;; relative to a custom-id or a headline title. Any other - ;; option is ignored. + ;; relative to a custom-id or a headline title. Append + ;; a hash sign to any unresolved option, as it might point + ;; to a target. (let ((option (org-element-property :search-option link))) (cond ((not option) raw-path) ((eq (aref option 0) ?#) (concat raw-path option)) - ;; External fuzzy link: try to resolve it if path - ;; belongs to current project, if any. - ((eq (aref option 0) ?*) - (concat - raw-path - (let ((numbers - (org-publish-resolve-external-fuzzy-link - (org-element-property :path link) option))) - (and numbers (concat "#sec-" - (mapconcat 'number-to-string - numbers "-")))))) - (t raw-path)))) + (t + (let ((destination + (org-publish-resolve-external-fuzzy-link + (org-element-property :path link) option))) + (concat raw-path + (if (not destination) (concat "#" option) + (concat "#sec-" + (mapconcat #'number-to-string + destination "-"))))))))) (t raw-path))) ;; Extract attributes from parent's paragraph. HACK: Only do ;; this for the first link in parent (inner image link for |