Remove sphinx.ext.oldcmarkup compatibility extension.

This commit is contained in:
Georg Brandl
2014-01-17 07:24:23 +01:00
parent 2371e50b19
commit 24a8b516bf
8 changed files with 6 additions and 119 deletions

View File

@@ -1,6 +1,11 @@
Release 1.3 (in development)
============================
Incompatible changes
--------------------
* Removed the ``sphinx.ext.oldcmarkup`` extension.
New features
------------

View File

@@ -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.

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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'

View File

@@ -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
================

View File

@@ -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'),