mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.8'
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -144,6 +144,9 @@ Bugs fixed
|
||||
* #5627: qthelp: index.html missing in QtHelp
|
||||
* #5659: linkcheck: crashes for a hyperlink containing multibyte character
|
||||
* #5754: DOC: Fix some mistakes in :doc:`/latex`
|
||||
* #5810: LaTeX: sphinxVerbatim requires explicit "hllines" set-up since 1.6.6
|
||||
(refs: #1238)
|
||||
* #5636: C++, fix parsing of floating point literals.
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
||||
@@ -293,7 +293,18 @@ _octal_literal_re = re.compile(r'0[0-7]*')
|
||||
_hex_literal_re = re.compile(r'0[xX][0-7a-fA-F][0-7a-fA-F]*')
|
||||
_binary_literal_re = re.compile(r'0[bB][01][01]*')
|
||||
_integer_suffix_re = re.compile(r'')
|
||||
_float_literal_re = re.compile(r'[+-]?[0-9]*\.[0-9]+')
|
||||
_float_literal_re = re.compile(r'''(?x)
|
||||
[+-]?(
|
||||
# decimal
|
||||
([0-9]+[eE][+-]?[0-9]+)
|
||||
| ([0-9]*\.[0-9]+([eE][+-]?[0-9]+)?)
|
||||
| ([0-9]+\.([eE][+-]?[0-9]+)?)
|
||||
# hex
|
||||
| (0[xX][0-9a-fA-F]+[pP][+-]?[0-9a-fA-F]+)
|
||||
| (0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+([pP][+-]?[0-9a-fA-F]+)?)
|
||||
| (0[xX][0-9a-fA-F]+\.([pP][+-]?[0-9a-fA-F]+)?)
|
||||
)
|
||||
''')
|
||||
_char_literal_re = re.compile(r'''(?x)
|
||||
((?:u8)|u|U|L)?
|
||||
'(
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
%
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
|
||||
\ProvidesPackage{sphinx}[2018/11/18 v1.8.3 LaTeX package (Sphinx markup)]
|
||||
\ProvidesPackage{sphinx}[2018/12/16 v1.8.3 LaTeX package (Sphinx markup)]
|
||||
|
||||
% provides \ltx@ifundefined
|
||||
% (many packages load ltxcmds: graphicx does for pdftex and lualatex but
|
||||
@@ -208,6 +208,9 @@
|
||||
% For highlighted code.
|
||||
\RequirePackage{fancyvrb}
|
||||
\define@key{FV}{hllines}{\def\sphinx@verbatim@checkifhl##1{\in@{, ##1,}{#1}}}
|
||||
% sphinxVerbatim must be usable by third party without requiring hllines set-up
|
||||
\def\sphinxresetverbatimhllines{\def\sphinx@verbatim@checkifhl##1{\in@false}}
|
||||
\sphinxresetverbatimhllines
|
||||
% For hyperlinked footnotes in tables; also for gathering footnotes from
|
||||
% topic and warning blocks. Also to allow code-blocks in footnotes.
|
||||
\RequirePackage{footnotehyper-sphinx}
|
||||
|
||||
@@ -2257,9 +2257,12 @@ class LaTeXTranslator(SphinxTranslator):
|
||||
else:
|
||||
hlcode += '\\end{sphinxVerbatim}'
|
||||
|
||||
hllines = '\\fvset{hllines={, %s,}}%%' %\
|
||||
str(highlight_args.get('hl_lines', []))[1:-1]
|
||||
self.body.append('\n' + hllines + '\n' + hlcode + '\n')
|
||||
hllines = str(highlight_args.get('hl_lines', []))[1:-1]
|
||||
if hllines:
|
||||
self.body.append('\n\\fvset{hllines={, %s,}}%%' % hllines)
|
||||
self.body.append('\n' + hlcode + '\n')
|
||||
if hllines:
|
||||
self.body.append('\\sphinxresetverbatimhllines\n')
|
||||
raise nodes.SkipNode
|
||||
|
||||
def depart_literal_block(self, node):
|
||||
|
||||
@@ -27,7 +27,6 @@ header2
|
||||
|
||||
\endlastfoot
|
||||
|
||||
\fvset{hllines={, ,}}%
|
||||
\begin{sphinxVerbatimintable}[commandchars=\\\{\}]
|
||||
\PYG{n}{hello} \PYG{n}{world}
|
||||
\end{sphinxVerbatimintable}
|
||||
|
||||
@@ -10,7 +10,6 @@ header1
|
||||
header2
|
||||
\\
|
||||
\hline
|
||||
\fvset{hllines={, ,}}%
|
||||
\begin{sphinxVerbatimintable}[commandchars=\\\{\}]
|
||||
\PYG{n}{hello} \PYG{n}{world}
|
||||
\end{sphinxVerbatimintable}
|
||||
|
||||
@@ -356,6 +356,8 @@ def test_code_block_emphasize_latex(app, status, warning):
|
||||
latex = (app.outdir / 'Python.tex').text(encoding='utf-8').replace('\r\n', '\n')
|
||||
includes = '\\fvset{hllines={, 5, 6, 13, 14, 15, 24, 25, 26, 27,}}%\n'
|
||||
assert includes in latex
|
||||
includes = '\\end{sphinxVerbatim}\n\sphinxresetverbatimhllines\n'
|
||||
assert includes in latex
|
||||
|
||||
|
||||
@pytest.mark.sphinx('xml', testroot='directive-code')
|
||||
|
||||
@@ -124,8 +124,20 @@ def test_expressions():
|
||||
expr = i + l + u
|
||||
exprCheck(expr, 'L' + expr + 'E')
|
||||
for suffix in ['', 'f', 'F', 'l', 'L']:
|
||||
expr = '5.0' + suffix
|
||||
exprCheck(expr, 'L' + expr + 'E')
|
||||
for e in [
|
||||
'5e42', '5e+42', '5e-42',
|
||||
'5.', '5.e42', '5.e+42', '5.e-42',
|
||||
'.5', '.5e42', '.5e+42', '.5e-42',
|
||||
'5.0', '5.0e42','5.0e+42', '5.0e-42']:
|
||||
expr = e + suffix
|
||||
exprCheck(expr, 'L' + expr + 'E')
|
||||
for e in [
|
||||
'ApF', 'Ap+F', 'Ap-F',
|
||||
'A.', 'A.pF', 'A.p+F', 'A.p-F',
|
||||
'.A', '.ApF', '.Ap+F', '.Ap-F',
|
||||
'A.B', 'A.BpF','A.Bp+F', 'A.Bp-F']:
|
||||
expr = "0x" + e + suffix
|
||||
exprCheck(expr, 'L' + expr + 'E')
|
||||
exprCheck('"abc\\"cba"', 'LA8_KcE') # string
|
||||
exprCheck('this', 'fpT')
|
||||
# character literals
|
||||
|
||||
@@ -224,8 +224,7 @@ def get_verifier(verify, verify_re):
|
||||
'verify',
|
||||
'::\n\n @Γ\\∞${}',
|
||||
None,
|
||||
('\\fvset{hllines={, ,}}%\n'
|
||||
'\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\}]\n'
|
||||
('\\begin{sphinxVerbatim}[commandchars=\\\\\\{\\}]\n'
|
||||
'@Γ\\PYGZbs{}\\(\\infty\\)\\PYGZdl{}\\PYGZob{}\\PYGZcb{}\n'
|
||||
'\\end{sphinxVerbatim}'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user