mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #4458 from tk0miya/refactor_i18n_reader
Drop unused method; LoggingReporter.set_source()
This commit is contained in:
commit
e8da18d88d
@ -80,7 +80,6 @@ class SphinxBaseReader(standalone.Reader):
|
||||
# substitute reporter
|
||||
reporter = document.reporter
|
||||
document.reporter = LoggingReporter.from_reporter(reporter)
|
||||
document.reporter.set_source(self.source)
|
||||
|
||||
return document
|
||||
|
||||
|
@ -18,7 +18,7 @@ from contextlib import contextmanager
|
||||
|
||||
import docutils
|
||||
from docutils.languages import get_language
|
||||
from docutils.statemachine import StateMachine, ViewList
|
||||
from docutils.statemachine import StateMachine
|
||||
from docutils.parsers.rst import directives, roles, convert_directive_function
|
||||
from docutils.utils import Reporter
|
||||
|
||||
@ -33,7 +33,7 @@ if False:
|
||||
# For type annotation
|
||||
from typing import Any, Callable, Generator, Iterator, List, Tuple # NOQA
|
||||
from docutils import nodes # NOQA
|
||||
from docutils.statemachine import State # NOQA
|
||||
from docutils.statemachine import State, ViewList # NOQA
|
||||
from sphinx.environment import BuildEnvironment # NOQA
|
||||
from sphinx.io import SphinxFileInput # NOQA
|
||||
|
||||
@ -183,21 +183,6 @@ class LoggingReporter(Reporter):
|
||||
stream = WarningStream()
|
||||
Reporter.__init__(self, source, report_level, halt_level,
|
||||
stream, debug, error_handler=error_handler)
|
||||
self.source_and_line = None # type: SphinxFileInput
|
||||
|
||||
def set_source(self, source):
|
||||
# type: (SphinxFileInput) -> None
|
||||
self.source_and_line = source
|
||||
|
||||
def system_message(self, *args, **kwargs):
|
||||
# type: (Any, Any) -> Any
|
||||
if kwargs.get('line') and isinstance(self.source_and_line, ViewList):
|
||||
# replace source parameter if source is set
|
||||
source, lineno = self.source_and_line.info(kwargs.get('line'))
|
||||
kwargs['source'] = source
|
||||
kwargs['line'] = lineno
|
||||
|
||||
return Reporter.system_message(self, *args, **kwargs)
|
||||
|
||||
|
||||
def is_html5_writer_available():
|
||||
|
Loading…
Reference in New Issue
Block a user