Remove deprecated feature: latex_keep_old_macro_names

This commit is contained in:
Takeshi KOMIYA 2017-04-27 21:49:19 +09:00
parent f2c93b3175
commit 361a34257b
6 changed files with 2 additions and 83 deletions

View File

@ -280,12 +280,6 @@ latex_documents = [
#
# latex_appendices = []
# If false, will not define \strong, \code, \titleref, \crossref ... but only
# \sphinxstrong, ..., \sphinxtitleref, ... to help avoid clash with user added
# packages.
#
# latex_keep_old_macro_names = True
# If false, no module index is generated.
#
# latex_domain_indices = True

View File

@ -1615,26 +1615,6 @@ These options influence LaTeX output. See further :doc:`latex`.
value selected the ``'inline'`` display. For backwards compatibility,
``True`` is still accepted.
.. confval:: latex_keep_old_macro_names
If ``True`` the ``\strong``, ``\code``, ``\bfcode``, ``\email``,
``\tablecontinued``, ``\titleref``, ``\menuselection``, ``\accelerator``,
``\crossref``, ``\termref``, and ``\optional`` text styling macros are
pre-defined by Sphinx and may be user-customized by some
``\renewcommand``'s inserted either via ``'preamble'`` key or :dudir:`raw
<raw-data-pass-through>` directive. If ``False``, only ``\sphinxstrong``,
etc... macros are defined (and may be redefined by user).
The default is ``False`` as it prevents macro name conflicts caused by
latex packages. For example (``lualatex`` or ``xelatex``) ``fontspec v2.6``
has its own ``\strong`` macro.
.. versionadded:: 1.4.5
.. versionchanged:: 1.6
Default was changed from ``True`` to ``False``.
.. deprecated:: 1.6
This setting will be removed at Sphinx 1.7.
.. confval:: latex_use_latex_multicolumn
If ``False`` (default), the LaTeX writer uses for merged cells in grid

View File

@ -414,10 +414,7 @@ Let us now list some macros from the package file
- text styling commands (they have one argument): ``\sphinx<foo>`` with
``<foo>`` being one of ``strong``, ``bfcode``, ``email``, ``tablecontinued``,
``titleref``, ``menuselection``, ``accelerator``, ``crossref``, ``termref``,
``optional``. The non-prefixed macros will still be defined if option
:confval:`latex_keep_old_macro_names` has been set to ``True`` (default is
``False``), in which case the prefixed macros expand to the
non-prefixed ones.
``optional``.
.. versionadded:: 1.4.5
Use of ``\sphinx`` prefixed macro names to limit possibilities of conflict

View File

@ -10,7 +10,6 @@
"""
import os
import warnings
from os import path
from docutils import nodes
@ -19,7 +18,6 @@ from docutils.utils import new_document
from docutils.frontend import OptionParser
from sphinx import package_dir, addnodes, highlighting
from sphinx.deprecation import RemovedInSphinx17Warning
from sphinx.config import string_classes, ENUM
from sphinx.errors import SphinxError
from sphinx.locale import _
@ -257,21 +255,6 @@ def validate_config_values(app):
app.config.latex_toplevel_sectioning)
app.config.latex_toplevel_sectioning = None # type: ignore
if 'footer' in app.config.latex_elements:
if 'postamble' in app.config.latex_elements:
logger.warning("latex_elements['footer'] conflicts with "
"latex_elements['postamble'], ignored.")
else:
warnings.warn("latex_elements['footer'] is deprecated. "
"Use latex_elements['preamble'] instead.",
RemovedInSphinx17Warning)
app.config.latex_elements['postamble'] = app.config.latex_elements['footer']
if app.config.latex_keep_old_macro_names:
warnings.warn("latex_keep_old_macro_names is deprecated. "
"LaTeX markup since Sphinx 1.4.5 uses only prefixed macro names.",
RemovedInSphinx17Warning)
def default_latex_engine(config):
# type: (Config) -> unicode
@ -305,7 +288,6 @@ def setup(app):
None)
app.add_config_value('latex_logo', None, None, string_classes)
app.add_config_value('latex_appendices', [], None)
app.add_config_value('latex_keep_old_macro_names', False, None)
app.add_config_value('latex_use_latex_multicolumn', False, None)
app.add_config_value('latex_toplevel_sectioning', None, None, [str])
app.add_config_value('latex_domain_indices', True, None, [list])

View File

@ -185,7 +185,6 @@
\DeclareStringOption[.5\dimexpr\inv@mag in\relax]{marginpar}
\fi
\DeclareBoolOption{dontkeepoldnames} % \ifspx@opt@dontkeepoldnames = \iffalse
\DeclareStringOption[0]{maxlistdepth}% \newcommand*\spx@opt@maxlistdepth{0}
% dimensions, we declare the \dimen registers here.
@ -1347,37 +1346,6 @@
\long\protected\def\sphinxoptional#1{%
{\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}}
\ifspx@opt@dontkeepoldnames\else
\let\spx@alreadydefinedlist\@empty
\typeout{** (sphinx) defining (legacy) text style macros without \string\sphinx\space prefix}
\typeout{** if clashes with packages, do not set latex_keep_old_macro_names=True
in conf.py}
\@for\@tempa:=code,strong,bfcode,email,tablecontinued,titleref,%
menuselection,accelerator,crossref,termref,optional\do
{% first, check if command with no prefix already exists
\ltx@ifundefined{\@tempa}{%
% give it the meaning defined so far with \sphinx prefix
\expandafter\let\csname\@tempa\expandafter\endcsname
\csname sphinx\@tempa\endcsname
% redefine the \sphinx prefixed macro to expand to non-prefixed one
\expandafter\def\csname sphinx\@tempa\expandafter\endcsname
\expandafter{\csname\@tempa\endcsname}%
}{\edef\spx@alreadydefinedlist{\spx@alreadydefinedlist{\@tempa}}}%
}%
\ifx\spx@alreadydefinedlist\@empty\else
\expandafter\@tfor\expandafter\@tempa\expandafter:\expandafter=\spx@alreadydefinedlist\do
{% emit warning now
\PackageWarning{sphinx}{not redefining already existing \@backslashchar\@tempa\space!^^J%
Anyhow, Sphinx mark-up uses only \string\sphinx\@tempa.}%
% and also at end of log for better visibility
\expandafter\sphinxdeprecationwarning\expandafter{\csname\@tempa\endcsname}{1.6}{1.7}
{\sphinxdeprecatedmacro\space already existed at Sphinx loading time! Not redefined!^^J
Sphinx mark-up uses only \string\sphinx\expandafter\@gobble\sphinxdeprecatedmacro.}%
}%
\fi
\sphinxdeprecationwarning{latex_keep_old_macro_names=True}{1.6}{1.7}{}%
\fi
% additional customizable styling
% FIXME: convert this to package options ?
\protected\def\sphinxstyleindexentry {\texttt}

View File

@ -58,7 +58,7 @@ DEFAULT_SETTINGS = {
'classoptions': '',
'extraclassoptions': '',
'maxlistdepth': '',
'sphinxpkgoptions': 'dontkeepoldnames',
'sphinxpkgoptions': '',
'sphinxsetup': '',
'passoptionstopackages': '',
'geometry': '\\usepackage{geometry}',
@ -548,8 +548,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.elements.update({
'releasename': _('Release'),
})
if builder.config.latex_keep_old_macro_names:
self.elements['sphinxpkgoptions'] = ''
if document.settings.docclass == 'howto':
docclass = builder.config.latex_docclass.get('howto', 'article')
else: