From: Chunyang Xu <mail@xuchunyang.me>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-info: Fix html export of info link
Date: Fri, 20 Jan 2017 01:51:38 +0800 [thread overview]
Message-ID: <m24m0vvsyd.fsf@xuchunyang.me> (raw)
[-- Attachment #1: Type: text/plain, Size: 523 bytes --]
Hi,
I notice the html export (actually, the HTML URL anchor part) of info
link is incorrect in some cases, for example
in (info "(org) Built-in table editor"), the corresponding org link is
[[info:org#Built-in%20table%20editor][info:org#Built-in table editor]]
org exports it to
https://www.gnu.org/software/emacs/manual/html_mono/org.html#Built-in-table-editor
but the correct one is
https://www.gnu.org/software/emacs/manual/html_mono/org.html#Built_002din-table-editor
I have submitted a patch to fix this.
[-- Attachment #2: 0001-org-info-Fix-html-export-of-info-link.patch --]
[-- Type: text/plain, Size: 1925 bytes --]
From 3084d1145968d32831270e8f00ca4aaf8c27c820 Mon Sep 17 00:00:00 2001
From: Chunyang Xu <mail@xuchunyang.me>
Date: Fri, 20 Jan 2017 01:08:26 +0800
Subject: [PATCH] org-info: Fix html export of info link
* org-info.el (org-info-map-node-url): New defun.
(org-info-export): Use the new function.
---
lisp/org-info.el | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/lisp/org-info.el b/lisp/org-info.el
index cbe4289fc..821348b61 100644
--- a/lisp/org-info.el
+++ b/lisp/org-info.el
@@ -113,6 +113,24 @@ 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-map-anchor-url (node)
+ "Return URL associated to Info NODE."
+ ;; See (info "(texinfo) HTML Xref Node Name Expansion") for the
+ ;; expansion rule
+ (let* ((node (replace-regexp-in-string "[ \t\n\r]+" " " (org-trim node)))
+ (node (mapconcat (lambda (c)
+ (if (string-match "[a-zA-Z0-9 ]" (string c))
+ (string c)
+ (format "_%04x" c)))
+ (string-to-list node) ""))
+ (node (replace-regexp-in-string " " "-" node))
+ (url (if (string= node "")
+ ""
+ (if (string-match "[0-9]" (substring node 0 1))
+ (concat "g_t" node)
+ node))))
+ url))
+
(defun org-info-export (path desc format)
"Export an info link.
See `org-link-parameters' for details about PATH, DESC and FORMAT."
@@ -123,7 +141,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-map-anchor-url node)
(or desc path)))))
(provide 'org-info)
--
2.11.0
next reply other threads:[~2017-01-19 17:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 17:51 Chunyang Xu [this message]
2017-01-21 13:21 ` [PATCH] org-info: Fix html export of info link Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m24m0vvsyd.fsf@xuchunyang.me \
--to=mail@xuchunyang.me \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.