From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chunyang Xu Subject: [PATCH] org-info: Fix html export of info link Date: Fri, 20 Jan 2017 01:51:38 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUGsN-00074o-FT for emacs-orgmode@gnu.org; Thu, 19 Jan 2017 12:51:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUGsK-0005IO-5p for emacs-orgmode@gnu.org; Thu, 19 Jan 2017 12:51:55 -0500 Received: from smtpbgau2.qq.com ([54.206.34.216]:46630) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cUGsJ-0005EE-HF for emacs-orgmode@gnu.org; Thu, 19 Jan 2017 12:51:52 -0500 Received: from Chunyangs-MacBook-Air.local (unknown [49.83.128.199]) by esmtp4.qq.com (ESMTP) with SMTP id 0 for ; Fri, 20 Jan 2017 01:51:38 +0800 (CST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0001-org-info-Fix-html-export-of-info-link.patch >From 3084d1145968d32831270e8f00ca4aaf8c27c820 Mon Sep 17 00:00:00 2001 From: Chunyang Xu 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 "%s" (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 --=-=-=--