Skip to content

Remove inliner_parse_text #12504

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

Merged
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
4 changes: 2 additions & 2 deletions sphinx/util/docutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
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+)?\\) ')
Expand Down Expand Up @@ -466,7 +466,7 @@ def parse_inline(
"""
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:
Expand Down
16 changes: 1 addition & 15 deletions sphinx/util/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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(
Expand Down Expand Up @@ -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:
Expand Down