From 8fc4896801e9a887d0004d17005ffdf5e21db1ed Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 17 Jan 2010 14:17:23 +0100 Subject: [PATCH] #321: Fix link generation in the LaTeX builder -- target names need to be escaped in references as well as definitions. --- CHANGES | 6 ++++++ sphinx/writers/latex.py | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 5e8d41ea6..66aee2446 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +Release 0.6.5 (in development) +============================== + +* #321: Fix link generation in the LaTeX builder. + + Release 0.6.4 (Jan 12, 2010) ============================ diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 8e1a6a80b..981c2eb8f 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1038,13 +1038,15 @@ class LaTeXTranslator(nodes.NodeVisitor): self.body.append('\\href{%s}{' % self.encode_uri(uri)) self.context.append('}') elif uri.startswith('#'): - self.body.append('\\hyperlink{%s}{' % uri[1:]) + # references to labels + self.body.append('\\hyperlink{%s}{' % self.idescape(uri[1:])) self.context.append('}') elif uri.startswith('%'): + # references to documents or labels inside documents hashindex = uri.find('#') targetname = (hashindex == -1) and '--doc-' + uri[1:] \ or uri[hashindex+1:] - self.body.append('\\hyperlink{%s}{' % targetname) + self.body.append('\\hyperlink{%s}{' % self.idescape(targetname)) self.context.append('}') elif uri.startswith('@token'): if self.in_production_list: