From 361a34257becbc0ae87c6ae10609427dab7ab11f Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 27 Apr 2017 21:49:19 +0900 Subject: [PATCH] Remove deprecated feature: latex_keep_old_macro_names --- doc/_static/conf.py.txt | 6 ------ doc/config.rst | 20 -------------------- doc/latex.rst | 5 +---- sphinx/builders/latex.py | 18 ------------------ sphinx/texinputs/sphinx.sty | 32 -------------------------------- sphinx/writers/latex.py | 4 +--- 6 files changed, 2 insertions(+), 83 deletions(-) diff --git a/doc/_static/conf.py.txt b/doc/_static/conf.py.txt index be0c846db..f1a4ecdbc 100644 --- a/doc/_static/conf.py.txt +++ b/doc/_static/conf.py.txt @@ -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 diff --git a/doc/config.rst b/doc/config.rst index 8c77ee2c6..7d303b0ee 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -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 - ` 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 diff --git a/doc/latex.rst b/doc/latex.rst index e2c518058..b8795fa19 100644 --- a/doc/latex.rst +++ b/doc/latex.rst @@ -414,10 +414,7 @@ Let us now list some macros from the package file - text styling commands (they have one argument): ``\sphinx`` with ```` 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 diff --git a/sphinx/builders/latex.py b/sphinx/builders/latex.py index 5b4150d1d..4e906ea60 100644 --- a/sphinx/builders/latex.py +++ b/sphinx/builders/latex.py @@ -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]) diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 0689a9480..f50384a62 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -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} diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index fc2cbb272..4900dbe29 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -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: