mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Drop function based directive support
This commit is contained in:
parent
9d33ec99b4
commit
301aee4916
4
CHANGES
4
CHANGES
@ -21,8 +21,10 @@ Deprecated
|
||||
|
||||
* :confval:`source_parsers` is deprecated. Please use ``add_source_parser()``
|
||||
instead.
|
||||
* ``app.import_object()`` is deprecated. Please use
|
||||
* ``Application.import_object()`` is deprecated. Please use
|
||||
``sphinx.util.import_object()`` instead.
|
||||
* Drop function based directive support. For now, Sphinx only supports class
|
||||
based directives.
|
||||
|
||||
Features added
|
||||
--------------
|
||||
|
@ -20,7 +20,7 @@ from collections import deque
|
||||
from os import path
|
||||
|
||||
from docutils import nodes
|
||||
from docutils.parsers.rst import directives, roles
|
||||
from docutils.parsers.rst import Directive, directives, roles
|
||||
from six import iteritems, itervalues
|
||||
from six.moves import cStringIO
|
||||
|
||||
@ -687,8 +687,6 @@ class Sphinx(object):
|
||||
self.enumerable_nodes[node] = (figtype, title_getter)
|
||||
self.add_node(node, **kwds)
|
||||
|
||||
# TODO(stephenfin): Remove docutils 0.4 style parsing and update the
|
||||
# example to use the newer style
|
||||
def add_directive(self, name, obj, content=None, arguments=None, **options):
|
||||
# type: (unicode, Any, bool, Tuple[int, int, bool], Any) -> None
|
||||
"""Register a Docutils directive.
|
||||
@ -726,6 +724,8 @@ class Sphinx(object):
|
||||
|
||||
.. versionchanged:: 0.6
|
||||
Docutils 0.5-style directive classes are now supported.
|
||||
.. deprecated:: 1.8
|
||||
Docutils 0.4-style (function based) directives support is deprecated.
|
||||
"""
|
||||
logger.debug('[app] adding directive: %r',
|
||||
(name, obj, content, arguments, options))
|
||||
@ -737,6 +737,11 @@ class Sphinx(object):
|
||||
directive = directive_helper(obj, content, arguments, **options)
|
||||
directives.register_directive(name, directive)
|
||||
|
||||
if not isinstance(obj, Directive):
|
||||
warnings.warn('function based directive support is now deprecated. '
|
||||
'Use class based directive instead.',
|
||||
RemovedInSphinx30Warning)
|
||||
|
||||
def add_role(self, name, role):
|
||||
# type: (unicode, Any) -> None
|
||||
"""Register a Docutils role.
|
||||
|
Loading…
Reference in New Issue
Block a user