diff options
author | Chunyang Xu <mail@xuchunyang.me> | 2017-01-20 01:51:38 +0800 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-01-21 13:48:27 +0100 |
commit | 9a952ab18a45adb5dce4cacf1b3e6cc8fac77eb6 (patch) | |
tree | e3925a0d6c97553852c258636dcf9cb9b2532e27 | |
parent | ade36c4b5032d52194f92d3212cbe79c9cd62f6e (diff) | |
download | org-mode-9a952ab18a45adb5dce4cacf1b3e6cc8fac77eb6.tar.gz |
org-info: Fix HTML export of info link
* org-info.el (org-info--map-node-url): New function.
(org-info-export): Use the new function.
TINYCHANGE
-rw-r--r-- | lisp/org-info.el | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/org-info.el b/lisp/org-info.el index cbe4289..79b9bcc 100644 --- a/lisp/org-info.el +++ b/lisp/org-info.el @@ -113,6 +113,19 @@ See `org-info-emacs-documents' and `org-info-other-documents' for details." ((cdr (assoc filename org-info-other-documents))) (t (concat filename ".html")))) +(defun org-info--expand-node-name (node) + "Expand Info NODE to HTML cross reference." + ;; See (info "(texinfo) HTML Xref Node Name Expansion") for the + ;; expansion rule. + (let ((node (replace-regexp-in-string + "\\([ \t\n\r]+\\)\\|\\([^a-zA-Z0-9]\\)" + (lambda (m) + (if (match-end 1) "-" (format "_%04x" (string-to-char m)))) + (org-trim node)))) + (cond ((string= node "") "") + ((string-match-p "\\`[0-9]" node) (concat "g_t" node)) + (t node)))) + (defun org-info-export (path desc format) "Export an info link. See `org-link-parameters' for details about PATH, DESC and FORMAT." @@ -123,7 +136,7 @@ See `org-link-parameters' for details about PATH, DESC and FORMAT." (node (or (match-string 2 path) "Top"))) (format "<a href=\"%s#%s\">%s</a>" (org-info-map-html-url filename) - (replace-regexp-in-string " " "-" node) + (org-info--expand-node-name node) (or desc path))))) (provide 'org-info) |