mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Deprecate abbreviation node (refs: #5720)
This commit is contained in:
parent
aaf0046f44
commit
08bc847964
1
CHANGES
1
CHANGES
@ -46,6 +46,7 @@ Deprecated
|
|||||||
is_meta_keywords()``
|
is_meta_keywords()``
|
||||||
* The ``suffix`` argument of ``env.doc2path()`` is deprecated.
|
* The ``suffix`` argument of ``env.doc2path()`` is deprecated.
|
||||||
* The string style ``base`` argument of ``env.doc2path()`` is deprecated.
|
* The string style ``base`` argument of ``env.doc2path()`` is deprecated.
|
||||||
|
* ``sphinx.addnodes.abbreviation``
|
||||||
* ``sphinx.application.Sphinx._setting_up_extension``
|
* ``sphinx.application.Sphinx._setting_up_extension``
|
||||||
* ``sphinx.config.check_unicode()``
|
* ``sphinx.config.check_unicode()``
|
||||||
* ``sphinx.ext.autodoc.importer._MockImporter``
|
* ``sphinx.ext.autodoc.importer._MockImporter``
|
||||||
|
@ -147,6 +147,11 @@ The following is a list of deprecated interfaces.
|
|||||||
- 4.0
|
- 4.0
|
||||||
- ``os.path.join()``
|
- ``os.path.join()``
|
||||||
|
|
||||||
|
* - ``sphinx.addnodes.abbreviation``
|
||||||
|
- 2.0
|
||||||
|
- 4.0
|
||||||
|
- ``docutils.nodes.abbreviation``
|
||||||
|
|
||||||
* - ``sphinx.config.check_unicode()``
|
* - ``sphinx.config.check_unicode()``
|
||||||
- 2.0
|
- 2.0
|
||||||
- 4.0
|
- 4.0
|
||||||
|
@ -13,7 +13,7 @@ import warnings
|
|||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
|
||||||
from sphinx.deprecation import RemovedInSphinx30Warning
|
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
@ -344,8 +344,18 @@ class literal_strong(nodes.strong, not_smartquotable):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class abbreviation(nodes.Inline, nodes.TextElement):
|
class abbreviation(nodes.abbreviation):
|
||||||
"""Node for abbreviations with explanations."""
|
"""Node for abbreviations with explanations.
|
||||||
|
|
||||||
|
.. deprecated:: 2.0
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, rawsource='', text='', *children, **attributes):
|
||||||
|
# type: (str, str, *nodes.Node, **Any) -> None
|
||||||
|
warnings.warn("abbrevition node for Sphinx was replaced by docutils'.",
|
||||||
|
RemovedInSphinx40Warning, stacklevel=2)
|
||||||
|
|
||||||
|
super(abbreviation, self).__init__(rawsource, text, *children, **attributes)
|
||||||
|
|
||||||
|
|
||||||
class manpage(nodes.Inline, nodes.FixedTextElement):
|
class manpage(nodes.Inline, nodes.FixedTextElement):
|
||||||
@ -389,7 +399,6 @@ def setup(app):
|
|||||||
app.add_node(download_reference)
|
app.add_node(download_reference)
|
||||||
app.add_node(literal_emphasis)
|
app.add_node(literal_emphasis)
|
||||||
app.add_node(literal_strong)
|
app.add_node(literal_strong)
|
||||||
app.add_node(abbreviation, override=True)
|
|
||||||
app.add_node(manpage)
|
app.add_node(manpage)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -343,12 +343,12 @@ def abbr_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
|||||||
text = utils.unescape(text)
|
text = utils.unescape(text)
|
||||||
m = _abbr_re.search(text)
|
m = _abbr_re.search(text)
|
||||||
if m is None:
|
if m is None:
|
||||||
return [addnodes.abbreviation(text, text, **options)], []
|
return [nodes.abbreviation(text, text, **options)], []
|
||||||
abbr = text[:m.start()].strip()
|
abbr = text[:m.start()].strip()
|
||||||
expl = m.group(1)
|
expl = m.group(1)
|
||||||
options = options.copy()
|
options = options.copy()
|
||||||
options['explanation'] = expl
|
options['explanation'] = expl
|
||||||
return [addnodes.abbreviation(abbr, abbr, **options)], []
|
return [nodes.abbreviation(abbr, abbr, **options)], []
|
||||||
|
|
||||||
|
|
||||||
def index_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
def index_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||||
|
Loading…
Reference in New Issue
Block a user