emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [TEXINFO] Link bug
@ 2013-02-15  2:05 Thomas S. Dye
  2013-02-15 17:10 ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas S. Dye @ 2013-02-15  2:05 UTC (permalink / raw)
  To: Org-mode

Hi,

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!

* Editing setup
#+name: setup-editing
#+header: :results silent
#+header: :eval no-export
#+begin_src emacs-lisp
(require 'ox-texinfo)
(define-key org-mode-map (kbd "C-c e") 'org-export-dispatch)
(setq org-pretty-entities nil)
(setq org-src-preserve-indentation t)
(setq org-confirm-babel-evaluate nil)
(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (sh . t)))
(add-to-list 'org-export-snippet-translation-alist
             '("info" . "texinfo"))
#+end_src

Here is the relevant texinfo output (note the parens in the second
@ref):

@node Headline to split
@chapter Headline to split

@ref{Headline-to-split}

@ref{(Headline to split),}, not!

All the best,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [TEXINFO] Link bug
  2013-02-15  2:05 [TEXINFO] Link bug Thomas S. Dye
@ 2013-02-15 17:10 ` Nicolas Goaziou
  2013-02-15 18:41   ` Thomas S. Dye
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2013-02-15 17:10 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

Hello,

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?

Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [TEXINFO] Link bug
  2013-02-15 17:10 ` Nicolas Goaziou
@ 2013-02-15 18:41   ` Thomas S. Dye
  2013-02-16 12:39     ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas S. Dye @ 2013-02-15 18:41 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode

Aloha Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> 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 :(

All the best,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [TEXINFO] Link bug
  2013-02-15 18:41   ` Thomas S. Dye
@ 2013-02-16 12:39     ` Nicolas Goaziou
  2013-02-16 16:19       ` Thomas S. Dye
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2013-02-16 12:39 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode, Jonathan Leech-Pepin

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]

tsd@tsdye.com (Thomas S. Dye) writes:

> Nicolas Goaziou <n.goaziou@gmail.com> 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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix fuzzy links to nodes --]
[-- Type: text/x-patch, Size: 3285 bytes --]

From 72985e92ab75c6b261bbec46aab2648098aac444 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [TEXINFO] Link bug
  2013-02-16 12:39     ` Nicolas Goaziou
@ 2013-02-16 16:19       ` Thomas S. Dye
  2013-02-20 16:11         ` Jonathan Leech-Pepin
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas S. Dye @ 2013-02-16 16:19 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode, Jonathan Leech-Pepin

Nicolas Goaziou <n.goaziou@gmail.com> writes:

>> 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.
>

Thanks Nicolas.  I'll wait for Jonathan to tweak ox-texinfo.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [TEXINFO] Link bug
  2013-02-16 16:19       ` Thomas S. Dye
@ 2013-02-20 16:11         ` Jonathan Leech-Pepin
  2013-02-20 18:39           ` Thomas S. Dye
  0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Leech-Pepin @ 2013-02-20 16:11 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

Hello,

On 16 February 2013 11:19, Thomas S. Dye <tsd@tsdye.com> wrote:

> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
> >> 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.
> >
>
> Thanks Nicolas.  I'll wait for Jonathan to tweak ox-texinfo.
>
>
I've applied Nicolas' patch.  From testing the ECM it fixes the issue.

Regards,

--
Jon

> All the best,
> Tom
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>

[-- Attachment #2: Type: text/html, Size: 1336 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [TEXINFO] Link bug
  2013-02-20 16:11         ` Jonathan Leech-Pepin
@ 2013-02-20 18:39           ` Thomas S. Dye
  2013-02-20 19:09             ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas S. Dye @ 2013-02-20 18:39 UTC (permalink / raw)
  To: Jonathan Leech-Pepin; +Cc: Nicolas Goaziou, Org-mode

Jonathan Leech-Pepin <jonathan.leechpepin@gmail.com> writes:

> Hello,
>
> On 16 February 2013 11:19, Thomas S. Dye <tsd@tsdye.com> wrote:
>
>> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>>
>> >> 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.
>> >
>>
>> Thanks Nicolas.  I'll wait for Jonathan to tweak ox-texinfo.
>>
>>
> I've applied Nicolas' patch.  From testing the ECM it fixes the issue.
>

With this patch, links to TEXINFO_MENU_TITLE properties are no longer
created.  If the problem looks difficult, I can work on an ECM.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [TEXINFO] Link bug
  2013-02-20 18:39           ` Thomas S. Dye
@ 2013-02-20 19:09             ` Nicolas Goaziou
  2013-02-21  0:41               ` Thomas S. Dye
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2013-02-20 19:09 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode, Jonathan Leech-Pepin

tsd@tsdye.com (Thomas S. Dye) writes:

>
> With this patch, links to TEXINFO_MENU_TITLE properties are no longer
> created.  If the problem looks difficult, I can work on an ECM.

It should be fixed. Between patch writing and its application, a change
in property syntax was introduced.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [TEXINFO] Link bug
  2013-02-20 19:09             ` Nicolas Goaziou
@ 2013-02-21  0:41               ` Thomas S. Dye
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas S. Dye @ 2013-02-21  0:41 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode, Jonathan Leech-Pepin

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> tsd@tsdye.com (Thomas S. Dye) writes:
>
>>
>> With this patch, links to TEXINFO_MENU_TITLE properties are no longer
>> created.  If the problem looks difficult, I can work on an ECM.
>
> It should be fixed. Between patch writing and its application, a change
> in property syntax was introduced.

Yes, that works nicely.  Thanks!

All the best,
Tom
-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-02-21  0:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-15  2:05 [TEXINFO] Link bug Thomas S. Dye
2013-02-15 17:10 ` Nicolas Goaziou
2013-02-15 18:41   ` Thomas S. Dye
2013-02-16 12:39     ` Nicolas Goaziou
2013-02-16 16:19       ` Thomas S. Dye
2013-02-20 16:11         ` Jonathan Leech-Pepin
2013-02-20 18:39           ` Thomas S. Dye
2013-02-20 19:09             ` Nicolas Goaziou
2013-02-21  0:41               ` Thomas S. Dye

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).