mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '2.0'
This commit is contained in:
commit
5da74898c3
25
CHANGES
25
CHANGES
@ -165,6 +165,31 @@ Bugs fixed
|
||||
Testing
|
||||
--------
|
||||
|
||||
Release 2.0.2 (in development)
|
||||
==============================
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
Incompatible changes
|
||||
--------------------
|
||||
|
||||
Deprecated
|
||||
----------
|
||||
|
||||
Features added
|
||||
--------------
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* #6286: C++, allow 8 and 9 in hexadecimal integer literals.
|
||||
* #6305: Fix the string in quickstart for 'path' argument of parser
|
||||
* LaTeX: Figures in admonitions produced errors (refs: #6364)
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
||||
Release 2.0.1 (released Apr 08, 2019)
|
||||
=====================================
|
||||
|
||||
|
@ -740,19 +740,41 @@ thus allowing redefinitions. Check the respective files for the defaults.
|
||||
Macros
|
||||
~~~~~~
|
||||
|
||||
- text styling commands ``\sphinx<foo>`` with ``<foo>`` being one of
|
||||
``strong``, ``bfcode``, ``email``, ``tablecontinued``, ``titleref``,
|
||||
``menuselection``, ``accelerator``, ``crossref``, ``termref``, ``optional``.
|
||||
- text styling commands:
|
||||
|
||||
- ``\sphinxstrong``,
|
||||
- ``\sphinxbfcode``,
|
||||
- ``\sphinxemail``,
|
||||
- ``\sphinxtablecontinued``,
|
||||
- ``\sphinxtitleref``,
|
||||
- ``\sphinxmenuselection``,
|
||||
- ``\sphinxaccelerator``,
|
||||
- ``\sphinxcrossref``,
|
||||
- ``\sphinxtermref``,
|
||||
- ``\sphinxoptional``.
|
||||
|
||||
.. versionadded:: 1.4.5
|
||||
Use of ``\sphinx`` prefixed macro names to limit possibilities of conflict
|
||||
with LaTeX packages.
|
||||
- more text styling: ``\sphinxstyle<bar>`` with ``<bar>`` one of
|
||||
``indexentry``, ``indexextra``, ``indexpageref``, ``topictitle``,
|
||||
``sidebartitle``, ``othertitle``, ``sidebarsubtitle``, ``theadfamily``,
|
||||
``emphasis``, ``literalemphasis``, ``strong``, ``literalstrong``,
|
||||
``abbreviation``, ``literalintitle``, ``codecontinued``, ``codecontinues``
|
||||
- more text styling:
|
||||
|
||||
- ``\sphinxstyleindexentry``,
|
||||
- ``\sphinxstyleindexextra``,
|
||||
- ``\sphinxstyleindexpageref``,
|
||||
- ``\sphinxstyletopictitle``,
|
||||
- ``\sphinxstylesidebartitle``,
|
||||
- ``\sphinxstyleothertitle``,
|
||||
- ``\sphinxstylesidebarsubtitle``,
|
||||
- ``\sphinxstyletheadfamily``,
|
||||
- ``\sphinxstyleemphasis``,
|
||||
- ``\sphinxstyleliteralemphasis``,
|
||||
- ``\sphinxstylestrong``,
|
||||
- ``\sphinxstyleliteralstrong``,
|
||||
- ``\sphinxstyleabbreviation``,
|
||||
- ``\sphinxstyleliteralintitle``,
|
||||
- ``\sphinxstylecodecontinued``,
|
||||
- ``\sphinxstylecodecontinues``.
|
||||
|
||||
.. versionadded:: 1.5
|
||||
these macros were formerly hard-coded as non customizable ``\texttt``,
|
||||
``\emph``, etc...
|
||||
@ -761,7 +783,7 @@ Macros
|
||||
multiple paragraphs in header cells of tables.
|
||||
.. versionadded:: 1.6.3
|
||||
``\sphinxstylecodecontinued`` and ``\sphinxstylecodecontinues``.
|
||||
- the table of contents is typeset via ``\sphinxtableofcontents`` which is a
|
||||
- ``\sphinxtableofcontents``: it is a
|
||||
wrapper (defined differently in :file:`sphinxhowto.cls` and in
|
||||
:file:`sphinxmanual.cls`) of standard ``\tableofcontents``. The macro
|
||||
``\sphinxtableofcontentshook`` is executed during its expansion right before
|
||||
@ -774,22 +796,22 @@ Macros
|
||||
done during loading of ``'manual'`` docclass are now executed later via
|
||||
``\sphinxtableofcontentshook``. This macro is also executed by the
|
||||
``'howto'`` docclass, but defaults to empty with it.
|
||||
- a custom ``\sphinxmaketitle`` is defined in the class files
|
||||
- ``\sphinxmaketitle``: it is defined in the class files
|
||||
:file:`sphinxmanual.cls` and :file:`sphinxhowto.cls` and is used as
|
||||
default setting of ``'maketitle'`` :confval:`latex_elements` key.
|
||||
|
||||
.. versionchanged:: 1.8.3
|
||||
formerly, ``\maketitle`` from LaTeX document class was modified by
|
||||
Sphinx.
|
||||
- for ``'manual'`` docclass a macro ``\sphinxbackoftitlepage``, if it is
|
||||
defined, gets executed at end of ``\sphinxmaketitle``, before the final
|
||||
- ``\sphinxbackoftitlepage``: for ``'manual'`` docclass, and if it is
|
||||
defined, it gets executed at end of ``\sphinxmaketitle``, before the final
|
||||
``\clearpage``. Use either the ``'maketitle'`` key or the ``'preamble'`` key
|
||||
of :confval:`latex_elements` to add a custom definition of
|
||||
``\sphinxbackoftitlepage``.
|
||||
|
||||
.. versionadded:: 1.8.3
|
||||
- the citation reference is typeset via ``\sphinxcite`` which is a wrapper
|
||||
of standard ``\cite``.
|
||||
- ``\sphinxcite``: it is a wrapper of standard ``\cite`` for citation
|
||||
references.
|
||||
|
||||
Environments
|
||||
~~~~~~~~~~~~
|
||||
@ -801,12 +823,23 @@ Environments
|
||||
.. versionadded:: 1.5.6
|
||||
formerly, the ``\small`` was hardcoded in LaTeX writer and the ending
|
||||
``\par`` was lacking.
|
||||
- for each admonition type ``<foo>``, the
|
||||
used environment is named ``sphinx<foo>``. They may be ``\renewenvironment``
|
||||
- environments associated with admonitions:
|
||||
|
||||
- ``sphinxnote``,
|
||||
- ``sphinxhint``,
|
||||
- ``sphinximportant``,
|
||||
- ``sphinxtip``,
|
||||
- ``sphinxwarning``,
|
||||
- ``sphinxcaution``,
|
||||
- ``sphinxattention``,
|
||||
- ``sphinxdanger``,
|
||||
- ``sphinxerror``.
|
||||
|
||||
They may be ``\renewenvironment``
|
||||
'd individually, and must then be defined with one argument (it is the heading
|
||||
of the notice, for example ``Warning:`` for :dudir:`warning` directive, if
|
||||
English is the document language). Their default definitions use either the
|
||||
*sphinxheavybox* (for the first listed directives) or the *sphinxlightbox*
|
||||
*sphinxheavybox* (for the last 5 ones) or the *sphinxlightbox*
|
||||
environments, configured to use the parameters (colours, border thickness)
|
||||
specific to each type, which can be set via ``'sphinxsetup'`` string.
|
||||
|
||||
|
@ -497,6 +497,17 @@ General configuration
|
||||
direct usage of :program:`sphinx-build` as it caches
|
||||
(in its default usage) the parsed source files in per builder locations.
|
||||
|
||||
.. hint:: An alternative way to effectively deactivate (or customize) the
|
||||
smart quotes for a given builder, for example ``latex``, is to use
|
||||
``make`` this way:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
make latex O="-D smartquotes_action="
|
||||
|
||||
This can follow some ``make html`` with no problem, in contrast to the
|
||||
situation from the prior note. It requires Docutils 0.14 or later.
|
||||
|
||||
.. versionadded:: 1.6.6
|
||||
|
||||
.. confval:: tls_verify
|
||||
|
@ -45,7 +45,7 @@ def handle_exception(app, args, exception, stderr=sys.stderr):
|
||||
traceback.print_exc(None, stderr)
|
||||
print(file=stderr)
|
||||
if isinstance(exception, KeyboardInterrupt):
|
||||
print(__('interrupted!'), file=stderr)
|
||||
print(__('Interrupted!'), file=stderr)
|
||||
elif isinstance(exception, SystemMessage):
|
||||
print(red(__('reST markup error:')), file=stderr)
|
||||
print(terminal_safe(exception.args[0]), file=stderr)
|
||||
|
@ -506,7 +506,7 @@ def get_parser():
|
||||
version='%%(prog)s %s' % __display_version__)
|
||||
|
||||
parser.add_argument('path', metavar='PROJECT_DIR', default='.', nargs='?',
|
||||
help=__('output path'))
|
||||
help=__('project root'))
|
||||
|
||||
group = parser.add_argument_group(__('Structure options'))
|
||||
group.add_argument('--sep', action='store_true', default=None,
|
||||
|
@ -48,8 +48,8 @@ class _ModuleWrapper:
|
||||
def __getattr__(self, name):
|
||||
# type: (str) -> Any
|
||||
if name in self._objects:
|
||||
warnings.warn("%s.%s is now deprecated. Please refer CHANGES to grasp "
|
||||
"the changes of Sphinx API." % (self._modname, name),
|
||||
warnings.warn("%s.%s is deprecated. Check CHANGES for Sphinx "
|
||||
"API modifications." % (self._modname, name),
|
||||
self._warning, stacklevel=3)
|
||||
return self._objects[name]
|
||||
|
||||
|
@ -292,7 +292,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
_integer_literal_re = re.compile(r'[1-9][0-9]*')
|
||||
_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]*')
|
||||
_hex_literal_re = re.compile(r'0[xX][0-9a-fA-F][0-9a-fA-F]*')
|
||||
_binary_literal_re = re.compile(r'0[bB][01][01]*')
|
||||
_integer_suffix_re = re.compile(r'')
|
||||
_float_literal_re = re.compile(r'''(?x)
|
||||
|
@ -466,6 +466,7 @@ class LaTeXTranslator(SphinxTranslator):
|
||||
self.in_term = 0
|
||||
self.needs_linetrimming = 0
|
||||
self.in_minipage = 0
|
||||
self.no_latex_floats = 0
|
||||
self.first_document = 1
|
||||
self.this_is_the_title = 1
|
||||
self.literal_whitespace = 0
|
||||
@ -1587,6 +1588,9 @@ class LaTeXTranslator(SphinxTranslator):
|
||||
|
||||
def visit_figure(self, node):
|
||||
# type: (nodes.Element) -> None
|
||||
align = self.elements['figure_align']
|
||||
if self.no_latex_floats:
|
||||
align = "H"
|
||||
if self.table:
|
||||
# TODO: support align option
|
||||
if 'width' in node:
|
||||
@ -1612,8 +1616,7 @@ class LaTeXTranslator(SphinxTranslator):
|
||||
self.body.append('\n\\begin{center}')
|
||||
self.context.append('\\end{center}\n')
|
||||
else:
|
||||
self.body.append('\n\\begin{figure}[%s]\n\\centering\n' %
|
||||
self.elements['figure_align'])
|
||||
self.body.append('\n\\begin{figure}[%s]\n\\centering\n' % align)
|
||||
if any(isinstance(child, nodes.caption) for child in node):
|
||||
self.body.append('\\capstart\n')
|
||||
self.context.append('\\end{figure}\n')
|
||||
@ -1653,20 +1656,24 @@ class LaTeXTranslator(SphinxTranslator):
|
||||
def visit_admonition(self, node):
|
||||
# type: (nodes.Element) -> None
|
||||
self.body.append('\n\\begin{sphinxadmonition}{note}')
|
||||
self.no_latex_floats += 1
|
||||
|
||||
def depart_admonition(self, node):
|
||||
# type: (nodes.Element) -> None
|
||||
self.body.append('\\end{sphinxadmonition}\n')
|
||||
self.no_latex_floats -= 1
|
||||
|
||||
def _visit_named_admonition(self, node):
|
||||
# type: (nodes.Element) -> None
|
||||
label = admonitionlabels[node.tagname]
|
||||
self.body.append('\n\\begin{sphinxadmonition}{%s}{%s:}' %
|
||||
(node.tagname, label))
|
||||
self.no_latex_floats += 1
|
||||
|
||||
def _depart_named_admonition(self, node):
|
||||
# type: (nodes.Element) -> None
|
||||
self.body.append('\\end{sphinxadmonition}\n')
|
||||
self.no_latex_floats -= 1
|
||||
|
||||
visit_attention = _visit_named_admonition
|
||||
depart_attention = _depart_named_admonition
|
||||
|
1
tests/roots/test-latex-figure-in-admonition/conf.py
Normal file
1
tests/roots/test-latex-figure-in-admonition/conf.py
Normal file
@ -0,0 +1 @@
|
||||
exclude_patterns = ['_build']
|
BIN
tests/roots/test-latex-figure-in-admonition/img.png
Normal file
BIN
tests/roots/test-latex-figure-in-admonition/img.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 65 KiB |
9
tests/roots/test-latex-figure-in-admonition/index.rst
Normal file
9
tests/roots/test-latex-figure-in-admonition/index.rst
Normal file
@ -0,0 +1,9 @@
|
||||
Test Figure in Admonition
|
||||
=========================
|
||||
|
||||
.. caution::
|
||||
|
||||
This uses a figure in an admonition.
|
||||
|
||||
.. figure:: img.png
|
||||
|
@ -1399,6 +1399,12 @@ def test_latex_labels(app, status, warning):
|
||||
assert result.count(r'\label{\detokenize{index:section1}}') == 1
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex', testroot='latex-figure-in-admonition')
|
||||
def test_latex_figure_in_admonition(app, status, warning):
|
||||
app.builder.build_all()
|
||||
result = (app.outdir / 'python.tex').text(encoding='utf8')
|
||||
assert(r'\begin{figure}[H]' in result)
|
||||
|
||||
def test_default_latex_documents():
|
||||
from sphinx.util import texescape
|
||||
texescape.init()
|
||||
|
@ -114,7 +114,7 @@ def test_expressions():
|
||||
exprCheck('nullptr', 'LDnE')
|
||||
exprCheck('true', 'L1E')
|
||||
exprCheck('false', 'L0E')
|
||||
ints = ['5', '0', '075', '0xF', '0XF', '0b1', '0B1']
|
||||
ints = ['5', '0', '075', '0x0123456789ABCDEF', '0XF', '0b1', '0B1']
|
||||
unsignedSuffix = ['', 'u', 'U']
|
||||
longSuffix = ['', 'l', 'L', 'll', 'LL']
|
||||
for i in ints:
|
||||
|
Loading…
Reference in New Issue
Block a user