Skip to content

Commit

Permalink
Remove deprecated make_old_id functions (#11360)
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Apr 27, 2023
1 parent 124957a commit 8dd44d1
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 87 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -9,6 +9,8 @@ Incompatible changes

* #11359: Remove long-deprecated aliases for ``MecabSplitter`` and
``DefaultSplitter`` in ``sphinx.search.ja``.
* #11360: Remove deprecated ``make_old_id`` functions in domain object
description classes.

Deprecated
----------
Expand Down
8 changes: 0 additions & 8 deletions sphinx/domains/c.py
Expand Up @@ -3312,14 +3312,6 @@ def after_content(self) -> None:
self.env.temp_data['c:parent_symbol'] = self.oldParentSymbol
self.env.ref_context['c:parent_key'] = self.oldParentKey

def make_old_id(self, name: str) -> str:
"""Generate old styled node_id for C objects.
.. note:: Old Styled node_id was used until Sphinx-3.0.
This will be removed in Sphinx-5.0.
"""
return 'c.' + name


class CMemberObject(CObject):
object_type = 'member'
Expand Down
16 changes: 0 additions & 16 deletions sphinx/domains/javascript.py
Expand Up @@ -207,14 +207,6 @@ def after_content(self) -> None:
self.env.ref_context['js:object'] = (objects[-1] if len(objects) > 0
else None)

def make_old_id(self, fullname: str) -> str:
"""Generate old styled node_id for JS objects.
.. note:: Old Styled node_id was used until Sphinx-3.0.
This will be removed in Sphinx-5.0.
"""
return fullname.replace('$', '_S_')

def _toc_entry_name(self, sig_node: desc_signature) -> str:
if not sig_node.get('_toc_parts'):
return ''
Expand Down Expand Up @@ -321,14 +313,6 @@ def run(self) -> list[Node]:
ret.extend(content_node.children)
return ret

def make_old_id(self, modname: str) -> str:
"""Generate old styled node_id for JS modules.
.. note:: Old Styled node_id was used until Sphinx-3.0.
This will be removed in Sphinx-5.0.
"""
return 'module-' + modname


class JSXRefRole(XRefRole):
def process_link(self, env: BuildEnvironment, refnode: Element,
Expand Down
10 changes: 0 additions & 10 deletions sphinx/domains/python.py
Expand Up @@ -1064,16 +1064,6 @@ def run(self) -> list[Node]:
ret.extend(content_node.children)
return ret

def make_old_id(self, name: str) -> str:
"""Generate old styled node_id.
Old styled node_id is incompatible with docutils' node_id.
It can contain dots and hyphens.
.. note:: Old styled node_id was mainly used until Sphinx-3.0.
"""
return 'module-%s' % name


class PyCurrentModule(SphinxDirective):
"""
Expand Down
16 changes: 0 additions & 16 deletions sphinx/domains/rst.py
Expand Up @@ -52,14 +52,6 @@ def add_target_and_index(self, name: str, sig: str, signode: desc_signature) ->
def get_index_text(self, objectname: str, name: str) -> str:
return ''

def make_old_id(self, name: str) -> str:
"""Generate old styled node_id for reST markups.
.. note:: Old Styled node_id was used until Sphinx-3.0.
This will be removed in Sphinx-5.0.
"""
return self.objtype + '-' + name

def _object_hierarchy_parts(self, sig_node: desc_signature) -> tuple[str, ...]:
if 'fullname' not in sig_node:
return ()
Expand Down Expand Up @@ -193,14 +185,6 @@ def current_directive(self) -> str:
else:
return ''

def make_old_id(self, name: str) -> str:
"""Generate old styled node_id for directive options.
.. note:: Old Styled node_id was used until Sphinx-3.0.
This will be removed in Sphinx-5.0.
"""
return '-'.join([self.objtype, self.current_directive, name])


class ReSTRole(ReSTMarkup):
"""
Expand Down
37 changes: 0 additions & 37 deletions sphinx/domains/std.py
Expand Up @@ -72,14 +72,6 @@ def add_target_and_index(self, name: str, sig: str, signode: desc_signature) ->
std = cast(StandardDomain, self.env.get_domain('std'))
std.note_object(self.objtype, name, node_id, location=signode)

def make_old_id(self, name: str) -> str:
"""Generate old styled node_id for generic objects.
.. note:: Old Styled node_id was used until Sphinx-3.0.
This will be removed in Sphinx-5.0.
"""
return self.objtype + '-' + name


class EnvVar(GenericObject):
indextemplate = _('environment variable; %s')
Expand Down Expand Up @@ -144,14 +136,6 @@ def run(self) -> list[Node]:

return ret

def make_old_id(self, name: str) -> str:
"""Generate old styled node_id for targets.
.. note:: Old Styled node_id was used until Sphinx-3.0.
This will be removed in Sphinx-5.0.
"""
return self.name + '-' + name


class Cmdoption(ObjectDescription[str]):
"""
Expand Down Expand Up @@ -228,11 +212,6 @@ def add_target_and_index(self, firstname: str, sig: str, signode: desc_signature
node_id = make_id(self.env, self.state.document, prefix, optname)
signode['ids'].append(node_id)

old_node_id = self.make_old_id(prefix, optname)
if old_node_id not in self.state.document.ids and \
old_node_id not in signode['ids']:
signode['ids'].append(old_node_id)

self.state.document.note_explicit_target(signode)

domain = cast(StandardDomain, self.env.get_domain('std'))
Expand All @@ -249,14 +228,6 @@ def add_target_and_index(self, firstname: str, sig: str, signode: desc_signature
entry = '; '.join([descr, option])
self.indexnode['entries'].append(('pair', entry, signode['ids'][0], '', None))

def make_old_id(self, prefix: str, optname: str) -> str:
"""Generate old styled node_id for cmdoption.
.. note:: Old Styled node_id was used until Sphinx-3.0.
This will be removed in Sphinx-5.0.
"""
return nodes.make_id(prefix + '-' + optname)


class Program(SphinxDirective):
"""
Expand Down Expand Up @@ -515,14 +486,6 @@ def run(self) -> list[Node]:
node.append(subnode)
return [node]

def make_old_id(self, token: str) -> str:
"""Generate old styled node_id for tokens.
.. note:: Old Styled node_id was used until Sphinx-3.0.
This will be removed in Sphinx-5.0.
"""
return nodes.make_id('grammar-token-' + token)


class TokenXRefRole(XRefRole):
def process_link(self, env: BuildEnvironment, refnode: Element, has_explicit_title: bool,
Expand Down

0 comments on commit 8dd44d1

Please sign in to comment.