From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [TEXINFO] Link bug Date: Sat, 16 Feb 2013 13:39:25 +0100 Message-ID: <87mwv45t6q.fsf@gmail.com> References: <87hald5wql.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6h3Q-0004M7-0f for emacs-orgmode@gnu.org; Sat, 16 Feb 2013 07:39:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6h3O-00036H-Jw for emacs-orgmode@gnu.org; Sat, 16 Feb 2013 07:39:43 -0500 Received: from mail-wg0-f43.google.com ([74.125.82.43]:46274) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6h3O-00035B-9B for emacs-orgmode@gnu.org; Sat, 16 Feb 2013 07:39:42 -0500 Received: by mail-wg0-f43.google.com with SMTP id e12so3515824wge.22 for ; Sat, 16 Feb 2013 04:39:41 -0800 (PST) In-Reply-To: (Thomas S. Dye's message of "Fri, 15 Feb 2013 08:41:12 -1000") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Thomas S. Dye" Cc: Org-mode , Jonathan Leech-Pepin --=-=-= Content-Type: text/plain tsd@tsdye.com (Thomas S. Dye) writes: > Nicolas Goaziou writes: > >> tsd@tsdye.com (Thomas S. Dye) writes: >> >>> I think the new code to handle split links has broken links that aren't >>> split. >>> >>> Here is an ECM: >>> >>> * Headline to split >>> >>> [[Headline >>> to split]] >>> >>> [[Headline to split]], not! >> >> This should be fixed. Could you confirm it? > > Au contraire. Here's what I get with the ECM I sent earlier: > > @node Headline to split > @chapter Headline to split > > @ref{(Headline to split),} > > @ref{(Headline to split),}, not! > > Now, both the links are broken :( This is good news: the problem is now consistent ;) Anyway, these links export fine to LaTeX, HTML and ASCII, which means the problem now resides in ox-texinfo.el. I attach a suggested solution for the problem. Cc'ed Jonathan so he can choose whether to apply it or not. Regards, -- Nicolas Goaziou --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ox-texinfo-Fix-fuzzy-links-to-headlines.patch Content-Description: fix fuzzy links to nodes >From 72985e92ab75c6b261bbec46aab2648098aac444 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 16 Feb 2013 13:36:18 +0100 Subject: [PATCH] ox-texinfo: Fix fuzzy links to headlines * lisp/ox-texinfo.el (org-texinfo--get-node): New function. (org-texinfo-headline, org-texinfo-link): Use new function. The same function is used to create @node entries and links to nodes, to avoid any descrepency between them. --- lisp/ox-texinfo.el | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index 20fa41d..3da567f 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -430,6 +430,17 @@ See `org-texinfo-text-markup-alist' for details." ;; Else use format string. (t (format fmt text))))) +(defun org-texinfo--get-node (headline info) + "Return node entry associated to HEADLINE. +INFO is a plist used as a communication channel." + (let ((menu-title (org-element-property :texinfo-menu-title headline))) + (org-texinfo--sanitize-menu + (replace-regexp-in-string + "%" "%%" + (if menu-title (org-export-data menu-title info) + (org-texinfo--sanitize-headline + (org-element-property :title headline) info)))))) + ;;; Headline sanitizing (defun org-texinfo--sanitize-headline (headline info) @@ -896,22 +907,12 @@ holding contextual information." (class-sectionning (assoc class org-texinfo-classes)) ;; Find the index type, if any (index (org-element-property :index headline)) - ;; Retrieve custom menu title (if any) - (menu-title (org-texinfo--sanitize-menu - (org-export-data - (org-element-property :texinfo-menu-title headline) - info))) ;; Retrieve headline text (text (org-texinfo--sanitize-headline (org-element-property :title headline) info)) ;; Create node info, to insert it before section formatting. ;; Use custom menu title if present - (node (format "@node %s\n" - (org-texinfo--sanitize-menu - (replace-regexp-in-string "%" "%%" - (if (not (string= "" menu-title)) - menu-title - text))))) + (node (format "@node %s\n" (org-texinfo--get-node headline info))) ;; Menus must be generated with first child, otherwise they ;; will not nest properly (menu (let* ((first (org-export-first-sibling-p headline info)) @@ -1180,8 +1181,7 @@ INFO is a plist holding contextual information. See ;; LINK points to an headline. Use the headline as the NODE target (headline (format "@ref{%s,%s}" - (or (org-element-property :texinfo-menu-title destination) - (org-element-property :title destination)) + (org-texinfo--get-node destination info) (or desc ""))) (otherwise (let ((path (org-export-solidify-link-text path))) @@ -1203,8 +1203,7 @@ INFO is a plist holding contextual information. See ;; LINK points to an headline. Use the headline as the NODE target (headline (format "@ref{%s,%s}" - (or (org-element-property :texinfo-menu-title destination) - (org-element-property :title destination)) + (org-texinfo--get-node destination info) (or desc ""))) (otherwise (let ((path (org-export-solidify-link-text path))) -- 1.8.1.3 --=-=-=--