From 24a8b516bfac00134881e52150978b4fd0008567 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 17 Jan 2014 07:24:23 +0100 Subject: [PATCH] Remove sphinx.ext.oldcmarkup compatibility extension. --- CHANGES | 5 +++ doc/ext/oldcmarkup.rst | 35 --------------------- doc/extensions.rst | 1 - sphinx/application.py | 2 -- sphinx/ext/oldcmarkup.py | 67 ---------------------------------------- tests/root/conf.py | 2 +- tests/root/objects.txt | 8 ----- tests/test_build_html.py | 5 --- 8 files changed, 6 insertions(+), 119 deletions(-) delete mode 100644 doc/ext/oldcmarkup.rst delete mode 100644 sphinx/ext/oldcmarkup.py diff --git a/CHANGES b/CHANGES index e4b5a17ff..be8a74001 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,11 @@ Release 1.3 (in development) ============================ +Incompatible changes +-------------------- + +* Removed the ``sphinx.ext.oldcmarkup`` extension. + New features ------------ diff --git a/doc/ext/oldcmarkup.rst b/doc/ext/oldcmarkup.rst deleted file mode 100644 index 0fdd9fecb..000000000 --- a/doc/ext/oldcmarkup.rst +++ /dev/null @@ -1,35 +0,0 @@ -:mod:`sphinx.ext.oldcmarkup` -- Compatibility extension for old C markup -======================================================================== - -.. module:: sphinx.ext.oldcmarkup - :synopsis: Allow further use of the pre-domain C markup -.. moduleauthor:: Georg Brandl - -.. versionadded:: 1.0 - - -This extension is a transition helper for projects that used the old -(pre-domain) C markup, i.e. the directives like ``cfunction`` and roles like -``cfunc``. Since the introduction of domains, they must be called by their -fully-qualified name (``c:function`` and ``c:func``, respectively) or, with the -default domain set to ``c``, by their new name (``function`` and ``func``). -(See :ref:`c-domain` for the details.) - -If you activate this extension, it will register the old names, and you can -use them like before Sphinx 1.0. The directives are: - -- ``cfunction`` -- ``cmember`` -- ``cmacro`` -- ``ctype`` -- ``cvar`` - -The roles are: - -- ``cdata`` -- ``cfunc`` -- ``cmacro`` -- ``ctype`` - -However, it is advised to migrate to the new markup -- this extension is a -compatibility convenience and will disappear in a future version of Sphinx. diff --git a/doc/extensions.rst b/doc/extensions.rst index 334e50392..7597f2812 100644 --- a/doc/extensions.rst +++ b/doc/extensions.rst @@ -53,7 +53,6 @@ These extensions are built in and can be activated by respective entries in the ext/extlinks ext/viewcode ext/linkcode - ext/oldcmarkup Third-party extensions diff --git a/sphinx/application.py b/sphinx/application.py index 751f39b5e..6b86b1810 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -113,8 +113,6 @@ class Sphinx(object): if self.confdir is None: self.confdir = self.srcdir - # backwards compatibility: activate old C markup - self.setup_extension('sphinx.ext.oldcmarkup') # load all user-given extension modules for extension in self.config.extensions: self.setup_extension(extension) diff --git a/sphinx/ext/oldcmarkup.py b/sphinx/ext/oldcmarkup.py deleted file mode 100644 index aa10246b9..000000000 --- a/sphinx/ext/oldcmarkup.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- coding: utf-8 -*- -""" - sphinx.ext.oldcmarkup - ~~~~~~~~~~~~~~~~~~~~~ - - Extension for compatibility with old C markup (directives and roles). - - :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -from docutils.parsers.rst import directives - -from sphinx.util.compat import Directive - -_warned_oldcmarkup = False -WARNING_MSG = 'using old C markup; please migrate to new-style markup ' \ - '(e.g. c:function instead of cfunction), see ' \ - 'http://sphinx-doc.org/domains.html' - - -class OldCDirective(Directive): - has_content = True - required_arguments = 1 - optional_arguments = 0 - final_argument_whitespace = True - option_spec = { - 'noindex': directives.flag, - 'module': directives.unchanged, - } - - def run(self): - env = self.state.document.settings.env - if not env.app._oldcmarkup_warned: - self.state_machine.reporter.warning(WARNING_MSG, line=self.lineno) - env.app._oldcmarkup_warned = True - newname = 'c:' + self.name[1:] - newdir = env.lookup_domain_element('directive', newname)[0] - return newdir(newname, self.arguments, self.options, - self.content, self.lineno, self.content_offset, - self.block_text, self.state, self.state_machine).run() - - -def old_crole(typ, rawtext, text, lineno, inliner, options={}, content=[]): - env = inliner.document.settings.env - if not typ: - typ = env.config.default_role - if not env.app._oldcmarkup_warned: - inliner.reporter.warning(WARNING_MSG, line=lineno) - env.app._oldcmarkup_warned = True - newtyp = 'c:' + typ[1:] - newrole = env.lookup_domain_element('role', newtyp)[0] - return newrole(newtyp, rawtext, text, lineno, inliner, options, content) - - -def setup(app): - app._oldcmarkup_warned = False - app.add_directive('cfunction', OldCDirective) - app.add_directive('cmember', OldCDirective) - app.add_directive('cmacro', OldCDirective) - app.add_directive('ctype', OldCDirective) - app.add_directive('cvar', OldCDirective) - app.add_role('cdata', old_crole) - app.add_role('cfunc', old_crole) - app.add_role('cmacro', old_crole) - app.add_role('ctype', old_crole) - app.add_role('cmember', old_crole) diff --git a/tests/root/conf.py b/tests/root/conf.py index 8025ba33c..3399043f9 100644 --- a/tests/root/conf.py +++ b/tests/root/conf.py @@ -8,7 +8,7 @@ sys.path.append(os.path.abspath('..')) extensions = ['sphinx.ext.autodoc', 'sphinx.ext.jsmath', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.autosummary', 'sphinx.ext.doctest', 'sphinx.ext.extlinks', - 'sphinx.ext.viewcode', 'sphinx.ext.oldcmarkup', 'ext'] + 'sphinx.ext.viewcode', 'ext'] jsmath_path = 'dummy.js' diff --git a/tests/root/objects.txt b/tests/root/objects.txt index 819c5dff6..73661d225 100644 --- a/tests/root/objects.txt +++ b/tests/root/objects.txt @@ -118,14 +118,6 @@ C items .. c:var:: sphinx_global -Old C items (from oldcmarkup ext) ---------------------------------- - -.. cfunction:: Sphinx_Func() - -Refer to :cfunc:`Sphinx_Func`. - - Javascript items ================ diff --git a/tests/test_build_html.py b/tests/test_build_html.py index 2f34e9e40..115ff0612 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -44,9 +44,6 @@ reading included file u'.*?wrongenc.inc' seems to be wrong, try giving an \ %(root)s/includes.txt:4: WARNING: download file not readable: .*?nonexisting.png %(root)s/markup.txt:\\d+: WARNING: Malformed :option: u'Python c option', does \ not contain option marker - or -- or / -%(root)s/objects.txt:\\d*: WARNING: using old C markup; please migrate to \ -new-style markup \(e.g. c:function instead of cfunction\), see \ -http://sphinx-doc.org/domains.html """ HTML_WARNINGS = ENV_WARNINGS + """\ @@ -191,8 +188,6 @@ HTML_XPATH = { (".//a[@href='#SPHINX_USE_PYTHON']", ''), (".//a[@href='#SphinxType']", ''), (".//a[@href='#sphinx_global']", ''), - # reference from old C markup extension - (".//a[@href='#Sphinx_Func']", ''), # test global TOC created by toctree() (".//ul[@class='current']/li[@class='toctree-l1 current']/a[@href='']", 'Testing object descriptions'),