mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch 'stable' into field-pending-xref-annotation
This commit is contained in:
commit
2f931be89b
4
CHANGES
4
CHANGES
@ -11,6 +11,7 @@ Features added
|
|||||||
--------------
|
--------------
|
||||||
|
|
||||||
* #3470: Make genindex support all kinds of letters, not only Latin ones
|
* #3470: Make genindex support all kinds of letters, not only Latin ones
|
||||||
|
* latex macros for directional double quotes (refs #3527)
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
@ -25,6 +26,9 @@ Bugs fixed
|
|||||||
are same without creation date. Thanks to Yoshiki Shibukawa.
|
are same without creation date. Thanks to Yoshiki Shibukawa.
|
||||||
* #3487: intersphinx: failed to refer options
|
* #3487: intersphinx: failed to refer options
|
||||||
* #3496: latex longtable's last column may be much wider than its contents
|
* #3496: latex longtable's last column may be much wider than its contents
|
||||||
|
* #3507: wrong quotes in latex output for productionlist directive
|
||||||
|
* #3533: Moving from Sphinx 1.3.1 to 1.5.3 breaks LaTeX compilation of links
|
||||||
|
rendered as code
|
||||||
* #2665, #2607: Link names in C++ docfields, and make it possible for other domains.
|
* #2665, #2607: Link names in C++ docfields, and make it possible for other domains.
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
|
@ -438,6 +438,14 @@ Let us now list some macros from the package file
|
|||||||
the new macros are wrappers of the formerly hard-coded ``\texttt``,
|
the new macros are wrappers of the formerly hard-coded ``\texttt``,
|
||||||
``\emph``, ... The default definitions can be found in
|
``\emph``, ... The default definitions can be found in
|
||||||
:file:`sphinx.sty`.
|
:file:`sphinx.sty`.
|
||||||
|
- macros for directional double quotes: pairs of straight double quote ``"``
|
||||||
|
in reST source are converted into LaTeX mark-up
|
||||||
|
``\sphinxquotedblleft{}`` and ``\sphinxquotedblright{}`` which default to
|
||||||
|
`````\ ````` and ``''`` (i.e. the TeX mark-up for directional double
|
||||||
|
quotes via font ligaturing mechanism.)
|
||||||
|
|
||||||
|
.. versionadded:: 1.5.4
|
||||||
|
Formerly, produced TeX was directly with `````\ ````` and ``''``.
|
||||||
- paragraph level environments: for each admonition type ``<foo>``, the
|
- paragraph level environments: for each admonition type ``<foo>``, the
|
||||||
used environment is named ``sphinx<foo>``. They may be ``\renewenvironment``
|
used environment is named ``sphinx<foo>``. They may be ``\renewenvironment``
|
||||||
'd individually, and must then be defined with one argument (it is the heading
|
'd individually, and must then be defined with one argument (it is the heading
|
||||||
|
@ -287,7 +287,7 @@
|
|||||||
\fi
|
\fi
|
||||||
% fix a space-gobbling issue due to LaTeX's original \do@noligs
|
% fix a space-gobbling issue due to LaTeX's original \do@noligs
|
||||||
\let\do@noligs\sphinx@do@noligs
|
\let\do@noligs\sphinx@do@noligs
|
||||||
\@noligs\endlinechar\m@ne\everyeof{\noexpand}%
|
\@noligs\endlinechar\m@ne
|
||||||
\expandafter\scantokens
|
\expandafter\scantokens
|
||||||
\fi {\texttt{#1}}}}
|
\fi {\texttt{#1}}}}
|
||||||
\def\sphinx@do@noligs #1{\catcode`#1\active\begingroup\lccode`\~`#1\relax
|
\def\sphinx@do@noligs #1{\catcode`#1\active\begingroup\lccode`\~`#1\relax
|
||||||
@ -592,22 +592,6 @@
|
|||||||
\newcommand*\sphinxbreaksatspaceinparsedliteral{%
|
\newcommand*\sphinxbreaksatspaceinparsedliteral{%
|
||||||
\lccode`~32 \lowercase{\let~}\spx@verbatim@space\lccode`\~`\~
|
\lccode`~32 \lowercase{\let~}\spx@verbatim@space\lccode`\~`\~
|
||||||
}
|
}
|
||||||
% now the hack for \url to work (hyperref is assumed in use):
|
|
||||||
% the aim it to deactivate - . , ; ? ! / in \url's argument.
|
|
||||||
% also the space token, but not end of lines which we assume don't arise there.
|
|
||||||
\def\spx@hack@hyper@normalise {%
|
|
||||||
\expandafter\spx@hack@hyper@normalise@aux\hyper@normalise
|
|
||||||
\spx@hack@hyper@normalise@aux\hyper@n@rmalise\relax\spx@undefined
|
|
||||||
}%
|
|
||||||
\long\def\spx@hack@hyper@normalise@aux#1\hyper@n@rmalise#2#3\spx@undefined{%
|
|
||||||
\ifx\spx@hack@hyper@normalise@aux#2%
|
|
||||||
\def\hyper@normalise{#1\sphinxunactivateextrasandspace\hyper@n@rmalise}%
|
|
||||||
\else
|
|
||||||
\PackageWarning{sphinx}{Could not patch \string\url\space command.%
|
|
||||||
^^J Not using extra active characters in alltt environment}%
|
|
||||||
\sphinxunactivateextras
|
|
||||||
\fi
|
|
||||||
}%
|
|
||||||
\newcommand*{\sphinxunactivateextras}{\let\do\@makeother
|
\newcommand*{\sphinxunactivateextras}{\let\do\@makeother
|
||||||
\sphinxbreaksbeforeactivelist\sphinxbreaksafteractivelist\do\-}%
|
\sphinxbreaksbeforeactivelist\sphinxbreaksafteractivelist\do\-}%
|
||||||
% the \catcode13=5\relax (deactivate end of input lines) is left to callers
|
% the \catcode13=5\relax (deactivate end of input lines) is left to callers
|
||||||
@ -623,7 +607,6 @@
|
|||||||
\sphinxbreaksattexescapedchars
|
\sphinxbreaksattexescapedchars
|
||||||
\sphinxbreaksviaactiveinparsedliteral
|
\sphinxbreaksviaactiveinparsedliteral
|
||||||
\sphinxbreaksatspaceinparsedliteral
|
\sphinxbreaksatspaceinparsedliteral
|
||||||
\spx@hack@hyper@normalise
|
|
||||||
% alltt takes care of the ' as derivative ("prime") in math mode
|
% alltt takes care of the ' as derivative ("prime") in math mode
|
||||||
\everymath\expandafter{\the\everymath\sphinxunactivateextrasandspace
|
\everymath\expandafter{\the\everymath\sphinxunactivateextrasandspace
|
||||||
\catcode`\<=12\catcode`\>=12\catcode`\^=7\catcode`\_=8 }%
|
\catcode`\<=12\catcode`\>=12\catcode`\^=7\catcode`\_=8 }%
|
||||||
@ -634,6 +617,23 @@
|
|||||||
\fi }
|
\fi }
|
||||||
{\end{alltt}}
|
{\end{alltt}}
|
||||||
|
|
||||||
|
% Protect \href's first argument in contexts such as sphinxalltt (or
|
||||||
|
% \sphinxcode). Sphinx uses \#, \%, \& ... always inside \sphinxhref.
|
||||||
|
\protected\def\sphinxhref#1#2{{%
|
||||||
|
\sphinxunactivateextrasandspace % never do \scantokens with active space!
|
||||||
|
\endlinechar\m@ne\everyeof{{#2}}% keep catcode regime for #2
|
||||||
|
\scantokens{\href{#1}}% normalise it for #1 during \href expansion
|
||||||
|
}}
|
||||||
|
% Same for \url. And also \nolinkurl for coherence.
|
||||||
|
\protected\def\sphinxurl#1{{%
|
||||||
|
\sphinxunactivateextrasandspace
|
||||||
|
\endlinechar\m@ne\scantokens{\url{#1}}%
|
||||||
|
}}
|
||||||
|
\protected\def\sphinxnolinkurl#1{{%
|
||||||
|
\sphinxunactivateextrasandspace
|
||||||
|
\endlinechar\m@ne\scantokens{\nolinkurl{#1}}%
|
||||||
|
}}
|
||||||
|
|
||||||
% Topic boxes
|
% Topic boxes
|
||||||
|
|
||||||
% Again based on use of "framed.sty", this allows breakable framed boxes.
|
% Again based on use of "framed.sty", this allows breakable framed boxes.
|
||||||
@ -1243,6 +1243,10 @@
|
|||||||
\protected\def\sphinxstyleabbreviation {\textsc}
|
\protected\def\sphinxstyleabbreviation {\textsc}
|
||||||
\protected\def\sphinxstyleliteralintitle {\sphinxcode}
|
\protected\def\sphinxstyleliteralintitle {\sphinxcode}
|
||||||
|
|
||||||
|
% LaTeX writer uses macros to hide double quotes from \sphinxcode's \@noligs
|
||||||
|
\protected\def\sphinxquotedblleft{``}
|
||||||
|
\protected\def\sphinxquotedblright{''}
|
||||||
|
|
||||||
% stylesheet for highlighting with pygments
|
% stylesheet for highlighting with pygments
|
||||||
\RequirePackage{sphinxhighlight}
|
\RequirePackage{sphinxhighlight}
|
||||||
|
|
||||||
|
@ -1755,12 +1755,12 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
elif uri.startswith(URI_SCHEMES):
|
elif uri.startswith(URI_SCHEMES):
|
||||||
if len(node) == 1 and uri == node[0]:
|
if len(node) == 1 and uri == node[0]:
|
||||||
if node.get('nolinkurl'):
|
if node.get('nolinkurl'):
|
||||||
self.body.append('\\nolinkurl{%s}' % self.encode_uri(uri))
|
self.body.append('\\sphinxnolinkurl{%s}' % self.encode_uri(uri))
|
||||||
else:
|
else:
|
||||||
self.body.append('\\url{%s}' % self.encode_uri(uri))
|
self.body.append('\\sphinxurl{%s}' % self.encode_uri(uri))
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
else:
|
else:
|
||||||
self.body.append('\\href{%s}{' % self.encode_uri(uri))
|
self.body.append('\\sphinxhref{%s}{' % self.encode_uri(uri))
|
||||||
self.context.append('}')
|
self.context.append('}')
|
||||||
elif uri.startswith('#'):
|
elif uri.startswith('#'):
|
||||||
# references to labels in the same document
|
# references to labels in the same document
|
||||||
@ -2209,7 +2209,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
def visit_Text(self, node):
|
def visit_Text(self, node):
|
||||||
text = self.encode(node.astext())
|
text = self.encode(node.astext())
|
||||||
if not self.no_contractions and not self.in_parsed_literal:
|
if not self.no_contractions and not self.in_parsed_literal:
|
||||||
text = educate_quotes_latex(text)
|
text = educate_quotes_latex(text,
|
||||||
|
dquotes=("\\sphinxquotedblleft{}",
|
||||||
|
"\\sphinxquotedblright{}"))
|
||||||
self.body.append(text)
|
self.body.append(text)
|
||||||
|
|
||||||
def depart_Text(self, node):
|
def depart_Text(self, node):
|
||||||
|
@ -551,20 +551,20 @@ def test_latex_show_urls_is_inline(app, status, warning):
|
|||||||
'First\n%\n\\end{footnote}') in result
|
'First\n%\n\\end{footnote}') in result
|
||||||
assert ('Second footnote: %\n\\begin{footnote}[1]\\sphinxAtStartFootnote\n'
|
assert ('Second footnote: %\n\\begin{footnote}[1]\\sphinxAtStartFootnote\n'
|
||||||
'Second\n%\n\\end{footnote}') in result
|
'Second\n%\n\\end{footnote}') in result
|
||||||
assert '\\href{http://sphinx-doc.org/}{Sphinx} (http://sphinx-doc.org/)' in result
|
assert '\\sphinxhref{http://sphinx-doc.org/}{Sphinx} (http://sphinx-doc.org/)' in result
|
||||||
assert ('Third footnote: %\n\\begin{footnote}[3]\\sphinxAtStartFootnote\n'
|
assert ('Third footnote: %\n\\begin{footnote}[3]\\sphinxAtStartFootnote\n'
|
||||||
'Third\n%\n\\end{footnote}') in result
|
'Third\n%\n\\end{footnote}') in result
|
||||||
assert ('\\href{http://sphinx-doc.org/~test/}{URL including tilde} '
|
assert ('\\sphinxhref{http://sphinx-doc.org/~test/}{URL including tilde} '
|
||||||
'(http://sphinx-doc.org/\\textasciitilde{}test/)') in result
|
'(http://sphinx-doc.org/\\textasciitilde{}test/)') in result
|
||||||
assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term} '
|
assert ('\\item[{\\sphinxhref{http://sphinx-doc.org/}{URL in term} '
|
||||||
'(http://sphinx-doc.org/)}] \\leavevmode\nDescription' in result)
|
'(http://sphinx-doc.org/)}] \\leavevmode\nDescription' in result)
|
||||||
assert ('\\item[{Footnote in term \\sphinxfootnotemark[5]}] '
|
assert ('\\item[{Footnote in term \\sphinxfootnotemark[5]}] '
|
||||||
'\\leavevmode%\n\\begin{footnotetext}[5]\\sphinxAtStartFootnote\n'
|
'\\leavevmode%\n\\begin{footnotetext}[5]\\sphinxAtStartFootnote\n'
|
||||||
'Footnote in term\n%\n\\end{footnotetext}\nDescription') in result
|
'Footnote in term\n%\n\\end{footnotetext}\nDescription') in result
|
||||||
assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist} '
|
assert ('\\item[{\\sphinxhref{http://sphinx-doc.org/}{Term in deflist} '
|
||||||
'(http://sphinx-doc.org/)}] \\leavevmode\nDescription') in result
|
'(http://sphinx-doc.org/)}] \\leavevmode\nDescription') in result
|
||||||
assert '\\url{https://github.com/sphinx-doc/sphinx}\n' in result
|
assert '\\sphinxurl{https://github.com/sphinx-doc/sphinx}\n' in result
|
||||||
assert ('\\href{mailto:sphinx-dev@googlegroups.com}'
|
assert ('\\sphinxhref{mailto:sphinx-dev@googlegroups.com}'
|
||||||
'{sphinx-dev@googlegroups.com}') in result
|
'{sphinx-dev@googlegroups.com}') in result
|
||||||
|
|
||||||
|
|
||||||
@ -594,29 +594,29 @@ def test_latex_show_urls_is_footnote(app, status, warning):
|
|||||||
'First\n%\n\\end{footnote}') in result
|
'First\n%\n\\end{footnote}') in result
|
||||||
assert ('Second footnote: %\n\\begin{footnote}[1]\\sphinxAtStartFootnote\n'
|
assert ('Second footnote: %\n\\begin{footnote}[1]\\sphinxAtStartFootnote\n'
|
||||||
'Second\n%\n\\end{footnote}') in result
|
'Second\n%\n\\end{footnote}') in result
|
||||||
assert ('\\href{http://sphinx-doc.org/}{Sphinx}'
|
assert ('\\sphinxhref{http://sphinx-doc.org/}{Sphinx}'
|
||||||
'%\n\\begin{footnote}[4]\\sphinxAtStartFootnote\n'
|
'%\n\\begin{footnote}[4]\\sphinxAtStartFootnote\n'
|
||||||
'\\nolinkurl{http://sphinx-doc.org/}\n%\n\\end{footnote}') in result
|
'\\sphinxnolinkurl{http://sphinx-doc.org/}\n%\n\\end{footnote}') in result
|
||||||
assert ('Third footnote: %\n\\begin{footnote}[6]\\sphinxAtStartFootnote\n'
|
assert ('Third footnote: %\n\\begin{footnote}[6]\\sphinxAtStartFootnote\n'
|
||||||
'Third\n%\n\\end{footnote}') in result
|
'Third\n%\n\\end{footnote}') in result
|
||||||
assert ('\\href{http://sphinx-doc.org/~test/}{URL including tilde}'
|
assert ('\\sphinxhref{http://sphinx-doc.org/~test/}{URL including tilde}'
|
||||||
'%\n\\begin{footnote}[5]\\sphinxAtStartFootnote\n'
|
'%\n\\begin{footnote}[5]\\sphinxAtStartFootnote\n'
|
||||||
'\\nolinkurl{http://sphinx-doc.org/~test/}\n%\n\\end{footnote}') in result
|
'\\sphinxnolinkurl{http://sphinx-doc.org/~test/}\n%\n\\end{footnote}') in result
|
||||||
assert ('\\item[{\\href{http://sphinx-doc.org/}'
|
assert ('\\item[{\\sphinxhref{http://sphinx-doc.org/}'
|
||||||
'{URL in term}\\sphinxfootnotemark[8]}] '
|
'{URL in term}\\sphinxfootnotemark[8]}] '
|
||||||
'\\leavevmode%\n\\begin{footnotetext}[8]\\sphinxAtStartFootnote\n'
|
'\\leavevmode%\n\\begin{footnotetext}[8]\\sphinxAtStartFootnote\n'
|
||||||
'\\nolinkurl{http://sphinx-doc.org/}\n%\n'
|
'\\sphinxnolinkurl{http://sphinx-doc.org/}\n%\n'
|
||||||
'\\end{footnotetext}\nDescription') in result
|
'\\end{footnotetext}\nDescription') in result
|
||||||
assert ('\\item[{Footnote in term \\sphinxfootnotemark[10]}] '
|
assert ('\\item[{Footnote in term \\sphinxfootnotemark[10]}] '
|
||||||
'\\leavevmode%\n\\begin{footnotetext}[10]\\sphinxAtStartFootnote\n'
|
'\\leavevmode%\n\\begin{footnotetext}[10]\\sphinxAtStartFootnote\n'
|
||||||
'Footnote in term\n%\n\\end{footnotetext}\nDescription') in result
|
'Footnote in term\n%\n\\end{footnotetext}\nDescription') in result
|
||||||
assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}'
|
assert ('\\item[{\\sphinxhref{http://sphinx-doc.org/}{Term in deflist}'
|
||||||
'\\sphinxfootnotemark[9]}] '
|
'\\sphinxfootnotemark[9]}] '
|
||||||
'\\leavevmode%\n\\begin{footnotetext}[9]\\sphinxAtStartFootnote\n'
|
'\\leavevmode%\n\\begin{footnotetext}[9]\\sphinxAtStartFootnote\n'
|
||||||
'\\nolinkurl{http://sphinx-doc.org/}\n%\n'
|
'\\sphinxnolinkurl{http://sphinx-doc.org/}\n%\n'
|
||||||
'\\end{footnotetext}\nDescription') in result
|
'\\end{footnotetext}\nDescription') in result
|
||||||
assert ('\\url{https://github.com/sphinx-doc/sphinx}\n' in result)
|
assert ('\\sphinxurl{https://github.com/sphinx-doc/sphinx}\n' in result)
|
||||||
assert ('\\href{mailto:sphinx-dev@googlegroups.com}'
|
assert ('\\sphinxhref{mailto:sphinx-dev@googlegroups.com}'
|
||||||
'{sphinx-dev@googlegroups.com}\n') in result
|
'{sphinx-dev@googlegroups.com}\n') in result
|
||||||
|
|
||||||
|
|
||||||
@ -646,19 +646,19 @@ def test_latex_show_urls_is_no(app, status, warning):
|
|||||||
'First\n%\n\\end{footnote}') in result
|
'First\n%\n\\end{footnote}') in result
|
||||||
assert ('Second footnote: %\n\\begin{footnote}[1]\\sphinxAtStartFootnote\n'
|
assert ('Second footnote: %\n\\begin{footnote}[1]\\sphinxAtStartFootnote\n'
|
||||||
'Second\n%\n\\end{footnote}') in result
|
'Second\n%\n\\end{footnote}') in result
|
||||||
assert '\\href{http://sphinx-doc.org/}{Sphinx}' in result
|
assert '\\sphinxhref{http://sphinx-doc.org/}{Sphinx}' in result
|
||||||
assert ('Third footnote: %\n\\begin{footnote}[3]\\sphinxAtStartFootnote\n'
|
assert ('Third footnote: %\n\\begin{footnote}[3]\\sphinxAtStartFootnote\n'
|
||||||
'Third\n%\n\\end{footnote}') in result
|
'Third\n%\n\\end{footnote}') in result
|
||||||
assert '\\href{http://sphinx-doc.org/~test/}{URL including tilde}' in result
|
assert '\\sphinxhref{http://sphinx-doc.org/~test/}{URL including tilde}' in result
|
||||||
assert ('\\item[{\\href{http://sphinx-doc.org/}{URL in term}}] '
|
assert ('\\item[{\\sphinxhref{http://sphinx-doc.org/}{URL in term}}] '
|
||||||
'\\leavevmode\nDescription') in result
|
'\\leavevmode\nDescription') in result
|
||||||
assert ('\\item[{Footnote in term \\sphinxfootnotemark[5]}] '
|
assert ('\\item[{Footnote in term \\sphinxfootnotemark[5]}] '
|
||||||
'\\leavevmode%\n\\begin{footnotetext}[5]\\sphinxAtStartFootnote\n'
|
'\\leavevmode%\n\\begin{footnotetext}[5]\\sphinxAtStartFootnote\n'
|
||||||
'Footnote in term\n%\n\\end{footnotetext}\nDescription') in result
|
'Footnote in term\n%\n\\end{footnotetext}\nDescription') in result
|
||||||
assert ('\\item[{\\href{http://sphinx-doc.org/}{Term in deflist}}] '
|
assert ('\\item[{\\sphinxhref{http://sphinx-doc.org/}{Term in deflist}}] '
|
||||||
'\\leavevmode\nDescription') in result
|
'\\leavevmode\nDescription') in result
|
||||||
assert ('\\url{https://github.com/sphinx-doc/sphinx}\n' in result)
|
assert ('\\sphinxurl{https://github.com/sphinx-doc/sphinx}\n' in result)
|
||||||
assert ('\\href{mailto:sphinx-dev@googlegroups.com}'
|
assert ('\\sphinxhref{mailto:sphinx-dev@googlegroups.com}'
|
||||||
'{sphinx-dev@googlegroups.com}\n') in result
|
'{sphinx-dev@googlegroups.com}\n') in result
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ def get_verifier(verify, verify_re):
|
|||||||
'verify_re',
|
'verify_re',
|
||||||
u'`test <http://example.com/~me/>`_',
|
u'`test <http://example.com/~me/>`_',
|
||||||
None,
|
None,
|
||||||
r'\\href{http://example.com/~me/}{test}.*',
|
r'\\sphinxhref{http://example.com/~me/}{test}.*',
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
def test_inline(get_verifier, type, rst, html_expected, latex_expected):
|
def test_inline(get_verifier, type, rst, html_expected, latex_expected):
|
||||||
|
Loading…
Reference in New Issue
Block a user