Fix #3708: LaTeX writer allows irc scheme

This commit is contained in:
Takeshi KOMIYA 2017-05-06 22:41:23 +09:00
parent 698d8d440e
commit 79b0c50165
2 changed files with 10 additions and 13 deletions

View File

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

View File

@ -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())