Merge pull request #1833 from xuhdev/latex-mailto

Email addresses should not be showed again if latex_show_urls is not None
This commit is contained in:
Takeshi KOMIYA 2015-12-19 10:45:53 +09:00
commit 7f55295650
4 changed files with 18 additions and 2 deletions

View File

@ -1404,9 +1404,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.body.append('\\href{%s}{' % self.encode_uri(uri))
# if configured, put the URL after the link
show_urls = self.builder.config.latex_show_urls
if uri.startswith('mailto:'):
uri = uri[7:]
if node.astext() != uri and show_urls and show_urls != 'no':
if uri.startswith('mailto:'):
uri = uri[7:]
if show_urls == 'footnote' and not \
(self.in_footnote or self.in_caption):
# obviously, footnotes in footnotes are not going to work

View File

@ -51,6 +51,7 @@ latex_documents = [
'Georg Brandl \\and someone else', 'manual'),
]
latex_show_urls = 'footnote'
latex_additional_files = ['svgimg.svg']
texinfo_documents = [

View File

@ -35,6 +35,18 @@ footnotes in table
* - VIDIOC_CROPCAP
- Information about VIDIOC_CROPCAP
URLs as footnotes
-----------------
`homepage <http://sphinx.org>`_
URLs should not be footnotes
----------------------------
GitHub Page: `https://github.com/sphinx-doc/sphinx <https://github.com/sphinx-doc/sphinx>`_
Mailing list: `sphinx-dev@googlegroups.com <mailto:sphinx-dev@googlegroups.com>`_
footenotes
--------------------

View File

@ -318,6 +318,9 @@ def test_footnote(app, status, warning):
assert ('\\end{threeparttable}\n\n'
'\\footnotetext[4]{\nfootnotes in table caption\n}'
'\\footnotetext[5]{\nfootnotes in table\n}' in result)
assert r'\href{http://sphinx.org}{homepage}\footnote{http://sphinx.org}' in result
assert r'\footnote{https://github.com/sphinx-doc/sphinx}' not in result
assert r'\footnote{sphinx-dev@googlegroups.com}' not in result
@with_app(buildername='latex', testroot='references-in-caption')