diff options
Diffstat (limited to 'sphinx')
-rw-r--r-- | sphinx/domains/cpp.py | 13 | ||||
-rw-r--r-- | sphinx/texinputs/sphinx.sty | 5 | ||||
-rw-r--r-- | sphinx/writers/latex.py | 9 |
3 files changed, 22 insertions, 5 deletions
diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index 40dfd5df9..380a9e98a 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -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)? '( diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index ab9c442d8..b44f23063 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -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} diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 318639ac8..5cbebf486 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -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): |