Skip to content

Commit 9276639

Browse files
authored
Remove inliner_parse_text (#12504)
This function is superfluous.
1 parent 122103f commit 9276639

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

sphinx/util/docutils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from sphinx.errors import SphinxError
2323
from sphinx.locale import _, __
2424
from sphinx.util import logging
25-
from sphinx.util.parsing import inliner_parse_text, nested_parse_to_nodes
25+
from sphinx.util.parsing import nested_parse_to_nodes
2626

2727
logger = logging.getLogger(__name__)
2828
report_re = re.compile('^(.+?:(?:\\d+)?): \\((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\\d+)?\\) ')
@@ -466,7 +466,7 @@ def parse_inline(
466466
"""
467467
if lineno == -1:
468468
lineno = self.lineno
469-
return inliner_parse_text(text, state=self.state, lineno=lineno)
469+
return self.state.inline_text(text, lineno)
470470

471471

472472
class SphinxRole:

sphinx/util/parsing.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
if TYPE_CHECKING:
1212
from collections.abc import Iterator
1313

14-
from docutils.parsers.rst.states import Inliner, RSTState, Struct
14+
from docutils.parsers.rst.states import RSTState
1515

1616

1717
def nested_parse_to_nodes(
@@ -73,20 +73,6 @@ def _fresh_title_style_context(state: RSTState) -> Iterator[None]:
7373
memo.section_level = surrounding_section_level
7474

7575

76-
def inliner_parse_text(
77-
text: str, *, state: RSTState, lineno: int = 1,
78-
) -> tuple[list[nodes.Node], list[nodes.system_message]]:
79-
"""Parse *text* as inline nodes.
80-
81-
The text cannot contain any structural elements (headings, transitions,
82-
directives, etc), so should be a simple line or paragraph of text.
83-
"""
84-
inliner: Inliner = state.inliner
85-
memo: Struct = state.memo
86-
parent: nodes.Element = state.parent
87-
return inliner.parse(text, lineno, memo, parent)
88-
89-
9076
def _text_to_string_list(
9177
text: str | StringList, /, *, source: str, tab_width: int,
9278
) -> StringList:

0 commit comments

Comments
 (0)