Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove make_old_id functions #11360

Merged
merged 2 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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