Remove `inliner_parse_text` (#12504)

This function is superfluous.
This commit is contained in:
Adam Turner 2024-07-02 23:31:56 +01:00 committed by GitHub
parent 122103f7be
commit 9276639fa6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 17 deletions

View File

@ -22,7 +22,7 @@ from docutils.writers._html_base import HTMLTranslator
from sphinx.errors import SphinxError
from sphinx.locale import _, __
from sphinx.util import logging
from sphinx.util.parsing import inliner_parse_text, nested_parse_to_nodes
from sphinx.util.parsing import nested_parse_to_nodes
logger = logging.getLogger(__name__)
report_re = re.compile('^(.+?:(?:\\d+)?): \\((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\\d+)?\\) ')
@ -466,7 +466,7 @@ class SphinxDirective(Directive):
"""
if lineno == -1:
lineno = self.lineno
return inliner_parse_text(text, state=self.state, lineno=lineno)
return self.state.inline_text(text, lineno)
class SphinxRole:

View File

@ -11,7 +11,7 @@ from docutils.statemachine import StringList, string2lines
if TYPE_CHECKING:
from collections.abc import Iterator
from docutils.parsers.rst.states import Inliner, RSTState, Struct
from docutils.parsers.rst.states import RSTState
def nested_parse_to_nodes(
@ -73,20 +73,6 @@ def _fresh_title_style_context(state: RSTState) -> Iterator[None]:
memo.section_level = surrounding_section_level
def inliner_parse_text(
text: str, *, state: RSTState, lineno: int = 1,
) -> tuple[list[nodes.Node], list[nodes.system_message]]:
"""Parse *text* as inline nodes.
The text cannot contain any structural elements (headings, transitions,
directives, etc), so should be a simple line or paragraph of text.
"""
inliner: Inliner = state.inliner
memo: Struct = state.memo
parent: nodes.Element = state.parent
return inliner.parse(text, lineno, memo, parent)
def _text_to_string_list(
text: str | StringList, /, *, source: str, tab_width: int,
) -> StringList: