From 79b0c501659027586c7f7756e1b2cc3b2f9d6541 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 6 May 2017 22:41:23 +0900 Subject: [PATCH] Fix #3708: LaTeX writer allows irc scheme --- CHANGES | 1 + sphinx/writers/latex.py | 22 +++++++++------------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/CHANGES b/CHANGES index e5fc48393..1c6fccd01 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,7 @@ Bugs fixed :confval:`html_compact_lists` is True. * #3685: AttributeError when using 3rd party domains * #3702: LaTeX writer styles figure legends with a hard-coded ``\small`` +* #3708: LaTeX writer allows irc scheme Testing -------- diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 44155da71..8f924c11c 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1753,16 +1753,6 @@ class LaTeXTranslator(nodes.NodeVisitor): uri = '%' + self.curfilestack[-1] + '#' + node['refid'] if self.in_title or not uri: self.context.append('') - elif uri.startswith(URI_SCHEMES): - if len(node) == 1 and uri == node[0]: - if node.get('nolinkurl'): - self.body.append('\\sphinxnolinkurl{%s}' % self.encode_uri(uri)) - else: - self.body.append('\\sphinxurl{%s}' % self.encode_uri(uri)) - raise nodes.SkipNode - else: - self.body.append('\\sphinxhref{%s}{' % self.encode_uri(uri)) - self.context.append('}') elif uri.startswith('#'): # references to labels in the same document id = self.curfilestack[-1] + ':' + uri[1:] @@ -1797,9 +1787,15 @@ class LaTeXTranslator(nodes.NodeVisitor): else: self.context.append('}}}') else: - self.builder.warn('unusable reference target found: %s' % uri, - (self.curfilestack[-1], node.line)) - self.context.append('') + if len(node) == 1 and uri == node[0]: + if node.get('nolinkurl'): + self.body.append('\\sphinxnolinkurl{%s}' % self.encode_uri(uri)) + else: + self.body.append('\\sphinxurl{%s}' % self.encode_uri(uri)) + raise nodes.SkipNode + else: + self.body.append('\\sphinxhref{%s}{' % self.encode_uri(uri)) + self.context.append('}') def depart_reference(self, node): self.body.append(self.context.pop())