mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #2383: The generated footnote by latex_show_urls
overflows lines
This commit is contained in:
parent
5cdf7a9a33
commit
b74b9cb585
1
CHANGES
1
CHANGES
@ -70,6 +70,7 @@ Bugs fixed
|
||||
* #2556: Xapian search does not work with Python 3
|
||||
* #2581: The search doesn't work if language="es" (spanish)
|
||||
* #2382: Adjust spacing after abbreviations on figure numbers in LaTeX writer
|
||||
* #2383: The generated footnote by `latex_show_urls` overflows lines
|
||||
|
||||
|
||||
Release 1.4.1 (released Apr 12, 2016)
|
||||
|
@ -195,7 +195,7 @@ class ShowUrlsTransform(object):
|
||||
def create_footnote(self, uri):
|
||||
label = nodes.label('', '#')
|
||||
para = nodes.paragraph()
|
||||
para.append(nodes.Text(uri))
|
||||
para.append(nodes.reference('', nodes.Text(uri), refuri=uri, nolinkurl=True))
|
||||
footnote = nodes.footnote(uri, label, para, auto=1)
|
||||
footnote['names'].append('#')
|
||||
self.document.note_autofootnote(footnote)
|
||||
@ -1636,7 +1636,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
self.context.append('')
|
||||
elif uri.startswith(URI_SCHEMES):
|
||||
if len(node) == 1 and uri == node[0]:
|
||||
self.body.append('\\url{%s}' % self.encode_uri(uri))
|
||||
if node.get('nolinkurl'):
|
||||
self.body.append('\\nolinkurl{%s}' % self.encode_uri(uri))
|
||||
else:
|
||||
self.body.append('\\url{%s}' % self.encode_uri(uri))
|
||||
raise nodes.SkipNode
|
||||
else:
|
||||
self.body.append('\\href{%s}{' % self.encode_uri(uri))
|
||||
|
@ -497,21 +497,22 @@ def test_latex_show_urls_is_footnote(app, status, warning):
|
||||
assert 'First footnote: \\footnote[3]{\sphinxAtStartFootnote%\nFirst\n}' in result
|
||||
assert 'Second footnote: \\footnote[1]{\sphinxAtStartFootnote%\nSecond\n}' in result
|
||||
assert ('\\href{http://sphinx-doc.org/}{Sphinx}'
|
||||
'\\footnote[4]{\sphinxAtStartFootnote%\nhttp://sphinx-doc.org/\n}' in result)
|
||||
'\\footnote[4]{\sphinxAtStartFootnote%\n'
|
||||
'\\nolinkurl{http://sphinx-doc.org/}\n}' in result)
|
||||
assert 'Third footnote: \\footnote[6]{\sphinxAtStartFootnote%\nThird\n}' in result
|
||||
assert ('\\href{http://sphinx-doc.org/~test/}{URL including tilde}'
|
||||
'\\footnote[5]{\sphinxAtStartFootnote%\n'
|
||||
'http://sphinx-doc.org/\\textasciitilde{}test/\n}' in result)
|
||||
'\\nolinkurl{http://sphinx-doc.org/~test/}\n}' in result)
|
||||
assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term}\\protect\\footnotemark[8]}] '
|
||||
'\\leavevmode\\footnotetext[8]{\sphinxAtStartFootnote%\n'
|
||||
'http://sphinx-doc.org/\n}\nDescription' in result)
|
||||
'\\nolinkurl{http://sphinx-doc.org/}\n}\nDescription' in result)
|
||||
assert ('\\item[{Footnote in term \\protect\\footnotemark[10]}] '
|
||||
'\\leavevmode\\footnotetext[10]{\sphinxAtStartFootnote%\n'
|
||||
'Footnote in term\n}\nDescription' in result)
|
||||
assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}\\protect'
|
||||
'\\footnotemark[9]}] '
|
||||
'\\leavevmode\\footnotetext[9]{\sphinxAtStartFootnote%\n'
|
||||
'http://sphinx-doc.org/\n}\nDescription' in result)
|
||||
'\\nolinkurl{http://sphinx-doc.org/}\n}\nDescription' in result)
|
||||
assert ('\\url{https://github.com/sphinx-doc/sphinx}\n' in result)
|
||||
assert ('\\href{mailto:sphinx-dev@googlegroups.com}'
|
||||
'{sphinx-dev@googlegroups.com}\n' in result)
|
||||
|
Loading…
Reference in New Issue
Block a user