mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #6744: support for seealso directive should be via an environment
This commit is contained in:
parent
08ca934fff
commit
bfd95dadf2
3
CHANGES
3
CHANGES
@ -16,6 +16,9 @@ Features added
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* #6744: LaTeX: support for seealso directive should be via an environment
|
||||
to allow styling.
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
||||
|
@ -1431,6 +1431,14 @@ Environments
|
||||
parameters, such as ``noteBorderColor``, ``noteborder``,
|
||||
``warningBgColor``, ``warningBorderColor``, ``warningborder``, ...
|
||||
|
||||
- Environment for the :rst:dir:`seealso` directive: ``sphinxseealso``.
|
||||
It takes one argument which will be the localized string ``See also``. Its
|
||||
default definition maintains the legacy behaviour: the localized ``See
|
||||
also``, followed with a colon, will be rendered using ``\sphinxstrong``.
|
||||
Nothing particular is done for the contents.
|
||||
|
||||
.. versionadded:: 6.1.0
|
||||
|
||||
- The :dudir:`contents` directive (with ``:local:`` option) and the
|
||||
:dudir:`topic` directive are implemented by environment ``sphinxShadowBox``.
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
%
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
|
||||
\ProvidesPackage{sphinx}[2022/08/15 v5.3.0 LaTeX package (Sphinx markup)]
|
||||
\ProvidesPackage{sphinx}[2023/01/03 v6.1.0 LaTeX package (Sphinx markup)]
|
||||
|
||||
% provides \ltx@ifundefined
|
||||
% (many packages load ltxcmds: graphicx does for pdftex and lualatex but
|
||||
|
@ -1,10 +1,12 @@
|
||||
%% NOTICES AND ADMONITIONS
|
||||
%
|
||||
% change this info string if making any custom modification
|
||||
\ProvidesFile{sphinxlatexadmonitions.sty}[2022/07/03 admonitions]
|
||||
\ProvidesFile{sphinxlatexadmonitions.sty}[2023/01/03 admonitions]
|
||||
|
||||
% Provides support for this output mark-up from Sphinx latex writer:
|
||||
%
|
||||
% - sphinxseealso environment added at 6.1.0
|
||||
%
|
||||
% - sphinxadmonition (environment)
|
||||
% This is a dispatch supporting
|
||||
%
|
||||
@ -31,6 +33,8 @@
|
||||
}
|
||||
|
||||
% Some are quite plain
|
||||
\newenvironment{sphinxseealso}[1]{\sphinxstrong{#1:}\par\nopagebreak}{}
|
||||
|
||||
% the spx@notice@bordercolor etc are set in the sphinxadmonition environment
|
||||
\newenvironment{sphinxlightbox}{%
|
||||
\par
|
||||
|
@ -821,11 +821,12 @@ class LaTeXTranslator(SphinxTranslator):
|
||||
|
||||
def visit_seealso(self, node: Element) -> None:
|
||||
self.body.append(BLANKLINE)
|
||||
self.body.append(r'\sphinxstrong{%s:}' % admonitionlabels['seealso'] + CR)
|
||||
self.body.append(r'\nopagebreak' + BLANKLINE)
|
||||
self.body.append(r'\begin{sphinxseealso}{%s}' % admonitionlabels['seealso'] + CR)
|
||||
|
||||
def depart_seealso(self, node: Element) -> None:
|
||||
self.body.append(BLANKLINE)
|
||||
self.body.append(r'\end{sphinxseealso}')
|
||||
self.body.append(BLANKLINE)
|
||||
|
||||
def visit_rubric(self, node: Element) -> None:
|
||||
if len(node) == 1 and node.astext() in ('Footnotes', _('Footnotes')):
|
||||
|
@ -135,6 +135,17 @@ def test_writer(app, status, warning):
|
||||
|
||||
assert 'Footnotes' not in result
|
||||
|
||||
assert ('\\begin{sphinxseealso}{See also}\n\n'
|
||||
'\\sphinxAtStartPar\n'
|
||||
'something, something else, something more\n'
|
||||
'\\begin{description}\n'
|
||||
'\\sphinxlineitem{\\sphinxhref{http://www.google.com}{Google}}\n'
|
||||
'\\sphinxAtStartPar\n'
|
||||
'For everything.\n'
|
||||
'\n'
|
||||
'\\end{description}\n'
|
||||
'\n\n\\end{sphinxseealso}\n\n' in result)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex', testroot='warnings', freshenv=True)
|
||||
def test_latex_warnings(app, status, warning):
|
||||
|
Loading…
Reference in New Issue
Block a user