mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Rename SphinxVerbatim to sphinxVerbatim for latex output
This commit is contained in:
parent
2cec5a25b2
commit
c2d417a032
@ -160,7 +160,7 @@
|
|||||||
% Support large numbered footnotes in minipage (cf. admonitions)
|
% Support large numbered footnotes in minipage (cf. admonitions)
|
||||||
\def\thempfootnote{\arabic{mpfootnote}}
|
\def\thempfootnote{\arabic{mpfootnote}}
|
||||||
|
|
||||||
% Preparations for SphinxVerbatim environment, which is a wrapper of fancyvrb
|
% Preparations for sphinxVerbatim environment, which is a wrapper of fancyvrb
|
||||||
% Verbatim with framing allowing pagebreaks, with border and background colors
|
% Verbatim with framing allowing pagebreaks, with border and background colors
|
||||||
% and possibly also a top caption, non separable by pagebreak. The original
|
% and possibly also a top caption, non separable by pagebreak. The original
|
||||||
% fancyvrb Verbatim is still used within tables.
|
% fancyvrb Verbatim is still used within tables.
|
||||||
@ -286,7 +286,7 @@
|
|||||||
\lccode`\~`\~
|
\lccode`\~`\~
|
||||||
}
|
}
|
||||||
|
|
||||||
\newenvironment{SphinxVerbatim}[1][1]{%
|
\newenvironment{sphinxVerbatim}[1][1]{%
|
||||||
% quit horizontal mode if we are still in a paragraph
|
% quit horizontal mode if we are still in a paragraph
|
||||||
\par
|
\par
|
||||||
% list starts new par, but we don't want it to be set apart vertically
|
% list starts new par, but we don't want it to be set apart vertically
|
||||||
@ -336,7 +336,7 @@
|
|||||||
{\kern\fontdimen2\font}%
|
{\kern\fontdimen2\font}%
|
||||||
}%
|
}%
|
||||||
% go around fancyvrb's check of \@currenvir
|
% go around fancyvrb's check of \@currenvir
|
||||||
\renewcommand*{\VerbatimEnvironment}{\gdef\FV@EnvironName{SphinxVerbatim}}%
|
\renewcommand*{\VerbatimEnvironment}{\gdef\FV@EnvironName{sphinxVerbatim}}%
|
||||||
% go around fancyvrb's check of current list depth
|
% go around fancyvrb's check of current list depth
|
||||||
\def\@toodeep {\advance\@listdepth\@ne}%
|
\def\@toodeep {\advance\@listdepth\@ne}%
|
||||||
% Allow breaks at special characters using \PYG... macros.
|
% Allow breaks at special characters using \PYG... macros.
|
||||||
|
@ -1909,11 +1909,11 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
self.table.has_verbatim = True
|
self.table.has_verbatim = True
|
||||||
else:
|
else:
|
||||||
hlcode = hlcode.replace('\\begin{Verbatim}',
|
hlcode = hlcode.replace('\\begin{Verbatim}',
|
||||||
'\\begin{SphinxVerbatim}')
|
'\\begin{sphinxVerbatim}')
|
||||||
# get consistent trailer
|
# get consistent trailer
|
||||||
hlcode = hlcode.rstrip()[:-14] # strip \end{Verbatim}
|
hlcode = hlcode.rstrip()[:-14] # strip \end{Verbatim}
|
||||||
self.body.append('\n' + hlcode + '\\end{%sVerbatim}\n' %
|
self.body.append('\n' + hlcode + '\\end{%sVerbatim}\n' %
|
||||||
((not self.table) and 'Sphinx' or ''))
|
((not self.table) and 'sphinx' or ''))
|
||||||
if ids:
|
if ids:
|
||||||
self.body.append('\\let\\sphinxLiteralBlockLabel\empty\n')
|
self.body.append('\\let\\sphinxLiteralBlockLabel\empty\n')
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
|
@ -228,11 +228,11 @@ def test_literalinclude_file_whole_of_emptyline(app, status, warning):
|
|||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
latex = (app.outdir / 'Python.tex').text(encoding='utf-8').replace('\r\n', '\n')
|
latex = (app.outdir / 'Python.tex').text(encoding='utf-8').replace('\r\n', '\n')
|
||||||
includes = (
|
includes = (
|
||||||
'\\begin{SphinxVerbatim}[commandchars=\\\\\\{\\},numbers=left,firstnumber=1,stepnumber=1]\n'
|
'\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\},numbers=left,firstnumber=1,stepnumber=1]\n'
|
||||||
'\n'
|
'\n'
|
||||||
'\n'
|
'\n'
|
||||||
'\n'
|
'\n'
|
||||||
'\\end{SphinxVerbatim}\n')
|
'\\end{sphinxVerbatim}\n')
|
||||||
assert includes in latex
|
assert includes in latex
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,9 +140,9 @@ def test_latex_escaping():
|
|||||||
r'\(\Gamma\)\textbackslash{}\(\infty\)\$')
|
r'\(\Gamma\)\textbackslash{}\(\infty\)\$')
|
||||||
# in verbatim code fragments
|
# in verbatim code fragments
|
||||||
yield (verify, u'::\n\n @Γ\\∞${}', None,
|
yield (verify, u'::\n\n @Γ\\∞${}', None,
|
||||||
u'\\begin{SphinxVerbatim}[commandchars=\\\\\\{\\}]\n'
|
u'\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\}]\n'
|
||||||
u'@\\(\\Gamma\\)\\PYGZbs{}\\(\\infty\\)\\PYGZdl{}\\PYGZob{}\\PYGZcb{}\n'
|
u'@\\(\\Gamma\\)\\PYGZbs{}\\(\\infty\\)\\PYGZdl{}\\PYGZob{}\\PYGZcb{}\n'
|
||||||
u'\\end{SphinxVerbatim}')
|
u'\\end{sphinxVerbatim}')
|
||||||
# in URIs
|
# in URIs
|
||||||
yield (verify_re, u'`test <http://example.com/~me/>`_', None,
|
yield (verify_re, u'`test <http://example.com/~me/>`_', None,
|
||||||
r'\\href{http://example.com/~me/}{test}.*')
|
r'\\href{http://example.com/~me/}{test}.*')
|
||||||
|
Loading…
Reference in New Issue
Block a user