mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
@@ -22,7 +22,7 @@ from docutils.writers._html_base import HTMLTranslator
|
|||||||
from sphinx.errors import SphinxError
|
from sphinx.errors import SphinxError
|
||||||
from sphinx.locale import _, __
|
from sphinx.locale import _, __
|
||||||
from sphinx.util import logging
|
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__)
|
logger = logging.getLogger(__name__)
|
||||||
report_re = re.compile('^(.+?:(?:\\d+)?): \\((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\\d+)?\\) ')
|
report_re = re.compile('^(.+?:(?:\\d+)?): \\((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\\d+)?\\) ')
|
||||||
@@ -466,7 +466,7 @@ class SphinxDirective(Directive):
|
|||||||
"""
|
"""
|
||||||
if lineno == -1:
|
if lineno == -1:
|
||||||
lineno = self.lineno
|
lineno = self.lineno
|
||||||
return inliner_parse_text(text, state=self.state, lineno=lineno)
|
return self.state.inline_text(text, lineno)
|
||||||
|
|
||||||
|
|
||||||
class SphinxRole:
|
class SphinxRole:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from docutils.statemachine import StringList, string2lines
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from collections.abc import Iterator
|
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(
|
def nested_parse_to_nodes(
|
||||||
@@ -73,20 +73,6 @@ def _fresh_title_style_context(state: RSTState) -> Iterator[None]:
|
|||||||
memo.section_level = surrounding_section_level
|
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(
|
def _text_to_string_list(
|
||||||
text: str | StringList, /, *, source: str, tab_width: int,
|
text: str | StringList, /, *, source: str, tab_width: int,
|
||||||
) -> StringList:
|
) -> StringList:
|
||||||
|
|||||||
Reference in New Issue
Block a user