Skip to content

Commit

Permalink
LaTeX: also admonition directives support box-decoration-break=slice
Browse files Browse the repository at this point in the history
  • Loading branch information
jfbu committed Mar 13, 2023
1 parent 27b30bb commit ee3c720
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 13 deletions.
6 changes: 4 additions & 2 deletions CHANGES
Expand Up @@ -25,6 +25,8 @@ Features added
now each be styled as the other admonitions, i.e. possibly with a background
color, individual border widths and paddings, possibly rounded corners, and
optional shadow. See :ref:`additionalcss`. (refs: #11234)
* LaTeX: admonitions and :dudir:`topic` (and contents_) directives,
and not only :rst:dir:`code-block`, support ``box-decoration-break=slice``.

Bugs fixed
----------
Expand Down Expand Up @@ -88,8 +90,6 @@ Bugs fixed
since Sphinx 5.1.0
* #11095: LaTeX: shadow of :dudir:`topic` and contents_ boxes not in page
margin since Sphinx 5.1.0

.. _contents: https://docutils.sourceforge.io/docs/ref/rst/directives.html#table-of-contents
* #11100: Fix copying images when running under parallel mode.

Release 6.1.1 (released Jan 05, 2023)
Expand Down Expand Up @@ -7376,3 +7376,5 @@ Previous versions
The changelog for versions before 1.0 can be found in the file ``CHANGES.old``
in the source distribution or `at GitHub
<https://github.com/sphinx-doc/sphinx/raw/master/CHANGES.old>`__.

.. _contents: https://docutils.sourceforge.io/docs/ref/rst/directives.html#table-of-contents
15 changes: 11 additions & 4 deletions doc/latex.rst
Expand Up @@ -1122,6 +1122,14 @@ Additional CSS-like ``'sphinxsetup'`` keys
``noteBgColor`` (or ``hintBgColor``, ...) also triggers usage of
``sphinxheavybox`` for :dudir:`note` (or :dudir:`hint`, ...).

.. versionadded:: 6.2.0

All "admonition" directives as well as :dudir:`topic` and contents_ now
support their respective ``box-decoration-break`` to be set to ``slice``.
Formerly, only :rst:dir:`code-block` did. It is undecided though if this
should inhibit the display of a bottom shadow, if set. Currently the shadow,
if set, is shown nevertheless but this is to be considered unstable.

Perhaps in future these 5.1.0 (and 6.2.0) novel settings will be optionally
imported from some genuine CSS external file, but currently they have to be used
via the ``'sphinxsetup'`` interface (or the ``\sphinxsetup`` LaTeX command
Expand Down Expand Up @@ -1194,10 +1202,9 @@ forget the underscore separating the prefix from the property names.
``border-left-width`` and ``border-right-width`` both to ``0pt``.

- ``<prefix>_box-decoration-break`` can be set to either ``clone`` or
``slice`` and configures the behavior at page breaks. It is currently
*ignored*: the behavior is as if ``clone`` had been specified. Except by
:rst:dir:`code-block` (i.e. for ``<prefix>=pre``) which defaults to using
``slice`` since 6.0.0 (former default was ``clone``).
``slice`` and configures the behavior at page breaks.
It defaults to ``slice`` for :rst:dir:`code-block` (i.e. for ``<prefix>=pre``)
since 6.0.0. For other directives the default is ``clone``.
- | ``<prefix>_padding-top``,
| ``<prefix>_padding-right``,
| ``<prefix>_padding-bottom``,
Expand Down
2 changes: 2 additions & 0 deletions sphinx/texinputs/sphinx.sty
Expand Up @@ -376,6 +376,8 @@ will be set to white}%
\spx@tempa{spx@box@} {box_} {box_border-width}\fboxrule
% Set default box-decoration-break style for codeblocks to slice
\spx@pre@border@opentrue % new default at 6.0.0: slice, not clone
% 6.2.0 has added support for box-decoration-break=slice to all
% other directives, formerly the option setting was ignored for them.

% Padding keys
%
Expand Down
10 changes: 10 additions & 0 deletions sphinx/texinputs/sphinxlatexadmonitions.sty
Expand Up @@ -138,6 +138,16 @@
\spx@boxes@fcolorbox{##1}%
\hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth
}%
% 6.2.0 adds support for div.<notice type>_box-decoration-break=slice.
% (it is yet undecided if slice style should inhibit a bottom shadow)
\csname ifspx@\spx@noticetype @border@open\endcsname
\def\FirstFrameCommand
{\spx@boxes@fcolorbox@setup@openbottom\FrameCommand}%
\def\MidFrameCommand
{\spx@boxes@fcolorbox@setup@openboth \FrameCommand}%
\def\LastFrameCommand
{\spx@boxes@fcolorbox@setup@opentop \FrameCommand}%
\fi
\savenotes
% use a minipage if we are already inside a framed environment
\ifspx@inframed
Expand Down
14 changes: 7 additions & 7 deletions sphinx/texinputs/sphinxpackageboxes.sty
Expand Up @@ -183,15 +183,16 @@
}% end of "no pict2e" branch

%%%%%%%%%%%%%%%%
% Support of box-decoration-break
% Support of box-decoration-break=slice
%
% 6.2.0 has renamed and moved this here from sphinxlatexliterals.sty,
% to facilitate supporting box-decoration-break=slice for all directives,
% not only code-block.
%
% 6.2.0 has renamed and moved this here from sphinxlatexliterals.sty.
% It also modified when these post actions are executed, in order
% for openboth to be able to trigger usage of fcolorbox@rectangle.
% So now openbottom and opentop also take advantage of this possible
% optimization.
%
% Currently only used by sphinxVerbatim, i.e. code-block directive.
\def\spx@boxes@fcolorbox@setup@openbottom{%
\spx@boxes@border@bottom \z@
\spx@boxes@radius@bottomright\z@
Expand Down Expand Up @@ -627,9 +628,8 @@
}% end of definition of \spx@boxes@borderpath@openbottom
% MEMO: at 6.2.0, this is still needed. If the user has set some corner radius
% to be positive and also both bottom and top border widths to be zero, this
% will be executed (and thus ignore the radii). But in the specific case of
% the MidFrameCommand of sphinxVerbatim under pre_box-decoration-break=slice
% (code-block is the only directive supporting it so far) the
% will be executed (and thus ignore the radii). But in the specific case of of
% a MidFrameCommand under box-decoration-break=slice context the
% \spx@boxes@fcolorbox@setup@openboth will have triggered usage of
% fcolorbox@rectangle, not fcolorbox@rounded, so this is not executed then.
\def\spx@boxes@borderpath@openboth{%
Expand Down

0 comments on commit ee3c720

Please sign in to comment.