Merge branch '5.0.x' into 5.x

This commit is contained in:
Jean-François B 2022-06-30 12:19:02 +02:00
commit b9736f2348
5 changed files with 18 additions and 5 deletions

View File

@ -61,6 +61,12 @@ Features added
Bugs fixed Bugs fixed
---------- ----------
* #10594: HTML Theme: field term colons are doubled if using Docutils 0.18+
* #10596: Build failure if Docutils version is 0.18 (not 0.18.1) due
to missing ``Node.findall()``
* #10506: LaTeX: build error when using ``:cpp:stuff`` syntax highlighting in
figure caption
Testing Testing
-------- --------

View File

@ -245,7 +245,7 @@ class LaTeXBuilder(Builder):
with open(stylesheet, 'w', encoding="utf-8") as f: with open(stylesheet, 'w', encoding="utf-8") as f:
f.write('\\NeedsTeXFormat{LaTeX2e}[1995/12/01]\n') f.write('\\NeedsTeXFormat{LaTeX2e}[1995/12/01]\n')
f.write('\\ProvidesPackage{sphinxhighlight}' f.write('\\ProvidesPackage{sphinxhighlight}'
'[2016/05/29 stylesheet for highlighting with pygments]\n') '[2022/06/30 stylesheet for highlighting with pygments]\n')
f.write('% Its contents depend on pygments_style configuration variable.\n\n') f.write('% Its contents depend on pygments_style configuration variable.\n\n')
f.write(highlighter.get_stylesheet()) f.write(highlighter.get_stylesheet())

View File

@ -40,9 +40,14 @@ escape_hl_chars = {ord('\\'): '\\PYGZbs{}',
ord('}'): '\\PYGZcb{}'} ord('}'): '\\PYGZcb{}'}
# used if Pygments is available # used if Pygments is available
# use textcomp quote to get a true single quote
_LATEX_ADD_STYLES = r''' _LATEX_ADD_STYLES = r'''
% Sphinx additions
% use textcomp quote to get a true single quote
\renewcommand\PYGZsq{\textquotesingle} \renewcommand\PYGZsq{\textquotesingle}
\makeatletter
% use \protected to allow \PYG in \caption
\protected\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+{\PYG@do{#2}}}
\makeatother
''' '''
# fix extra space between lines when Pygments highlighting uses \fcolorbox # fix extra space between lines when Pygments highlighting uses \fcolorbox
# add a {..} to limit \fboxsep scope, and force \fcolorbox use correct value # add a {..} to limit \fboxsep scope, and force \fcolorbox use correct value
@ -52,7 +57,7 @@ _LATEX_ADD_STYLES_FIXPYG = r'''
% fix for Pygments <= 2.7.4 % fix for Pygments <= 2.7.4
\let\spx@original@fcolorbox\fcolorbox \let\spx@original@fcolorbox\fcolorbox
\def\spx@fixpyg@fcolorbox{\fboxsep-\fboxrule\spx@original@fcolorbox} \def\spx@fixpyg@fcolorbox{\fboxsep-\fboxrule\spx@original@fcolorbox}
\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+% \protected\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+%
{\let\fcolorbox\spx@fixpyg@fcolorbox\PYG@do{#2}}} {\let\fcolorbox\spx@fixpyg@fcolorbox\PYG@do{#2}}}
\makeatother \makeatother
''' '''

View File

@ -686,9 +686,11 @@ dl.field-list > dt {
padding-right: 5px; padding-right: 5px;
} }
{%- if docutils_version_info[:2] < (0, 18) %}
dl.field-list > dt:after { dl.field-list > dt:after {
content: ":"; content: ":";
} }
{% endif %}
dl.field-list > dd { dl.field-list > dd {
padding-left: 0.5em; padding-left: 0.5em;

View File

@ -550,9 +550,9 @@ class SphinxTranslator(nodes.NodeVisitor):
# Node.findall() is a new interface to traverse a doctree since docutils-0.18. # Node.findall() is a new interface to traverse a doctree since docutils-0.18.
# This applies a patch docutils-0.17 or older to be available Node.findall() # This applies a patch to docutils up to 0.18 inclusive to provide Node.findall()
# method to use it from our codebase. # method to use it from our codebase.
if docutils.__version_info__ < (0, 18): if docutils.__version_info__ <= (0, 18):
def findall(self, *args, **kwargs): def findall(self, *args, **kwargs):
return iter(self.traverse(*args, **kwargs)) return iter(self.traverse(*args, **kwargs))