Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-03-29 17:52:32 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-03-30 08:50:37 +0300
commit61098a0ae2e696a804459d36bd74ca57db76eda5 (patch)
tree2d71c39d199fec7366a013e0b48c1b2fb4bc83ee /sphinx/io.py
parentc1a254f2491436ac304f1f169aa488438abe4193 (diff)
Drop features and APIs deprecated in 1.8
Diffstat (limited to 'sphinx/io.py')
-rw-r--r--sphinx/io.py102
1 files changed, 0 insertions, 102 deletions
diff --git a/sphinx/io.py b/sphinx/io.py
index b5b57d065..105ed4397 100644
--- a/sphinx/io.py
+++ b/sphinx/io.py
@@ -8,17 +8,14 @@
:license: BSD, see LICENSE for details.
"""
import codecs
-import warnings
from typing import Any
from docutils.core import Publisher
from docutils.io import FileInput, NullOutput
from docutils.parsers.rst import Parser as RSTParser
from docutils.readers import standalone
-from docutils.statemachine import StringList, string2lines
from docutils.writers import UnfilteredWriter
-from sphinx.deprecation import RemovedInSphinx30Warning
from sphinx.transforms import (
AutoIndexUpgrader, DoctreeReadEvent, FigureAligner, SphinxTransformer
)
@@ -29,7 +26,6 @@ from sphinx.transforms.references import SphinxDomains
from sphinx.util import logging
from sphinx.util import UnicodeDecodeErrorHandler
from sphinx.util.docutils import LoggingReporter
-from sphinx.util.rst import append_epilog, docinfo_re, prepend_prolog
from sphinx.versioning import UIDTransform
if False:
@@ -136,19 +132,6 @@ class SphinxI18nReader(SphinxBaseReader):
super().__init__(app, *args, **kwargs)
- def set_lineno_for_reporter(self, lineno):
- # type: (int) -> None
- """Stores the source line number of original text."""
- warnings.warn('SphinxI18nReader.set_lineno_for_reporter() is deprecated.',
- RemovedInSphinx30Warning, stacklevel=2)
-
- @property
- def line(self):
- # type: () -> int
- warnings.warn('SphinxI18nReader.line is deprecated.',
- RemovedInSphinx30Warning, stacklevel=2)
- return 0
-
class SphinxDummyWriter(UnfilteredWriter):
"""Dummy writer module used for generating doctree."""
@@ -166,99 +149,14 @@ def SphinxDummySourceClass(source, *args, **kwargs):
return source
-class SphinxBaseFileInput(FileInput):
- """A base class of SphinxFileInput.
-
- It supports to replace unknown Unicode characters to '?'.
- """
-
- def __init__(self, app, env, *args, **kwds):
- # type: (Sphinx, BuildEnvironment, Any, Any) -> None
- self.app = app
- self.env = env
-
- warnings.warn('%s is deprecated.' % self.__class__.__name__,
- RemovedInSphinx30Warning, stacklevel=2)
-
- kwds['error_handler'] = 'sphinx' # py3: handle error on open.
- super().__init__(*args, **kwds)
-
- def warn_and_replace(self, error):
- # type: (Any) -> Tuple
- return UnicodeDecodeErrorHandler(self.env.docname)(error)
-
-
class SphinxFileInput(FileInput):
"""A basic FileInput for Sphinx."""
- supported = ('*',) # RemovedInSphinx30Warning
-
def __init__(self, *args, **kwargs):
# type: (Any, Any) -> None
kwargs['error_handler'] = 'sphinx'
super().__init__(*args, **kwargs)
-class SphinxRSTFileInput(SphinxBaseFileInput):
- """A reST FileInput for Sphinx.
-
- This FileInput automatically prepends and appends text by :confval:`rst_prolog` and
- :confval:`rst_epilog`.
-
- .. important::
-
- This FileInput uses an instance of ``StringList`` as a return value of ``read()``
- method to indicate original source filename and line numbers after prepending and
- appending.
- For that reason, ``sphinx.parsers.RSTParser`` should be used with this to parse
- a content correctly.
- """
- supported = ('restructuredtext',)
-
- def prepend_prolog(self, text, prolog):
- # type: (StringList, str) -> None
- docinfo = self.count_docinfo_lines(text)
- if docinfo:
- # insert a blank line after docinfo
- text.insert(docinfo, '', '<generated>', 0)
- docinfo += 1
-
- # insert prolog (after docinfo if exists)
- for lineno, line in enumerate(prolog.splitlines()):
- text.insert(docinfo + lineno, line, '<rst_prolog>', lineno)
-
- text.insert(docinfo + lineno + 1, '', '<generated>', 0)
-
- def append_epilog(self, text, epilog):
- # type: (StringList, str) -> None
- # append a blank line and rst_epilog
- text.append('', '<generated>', 0)
- for lineno, line in enumerate(epilog.splitlines()):
- text.append(line, '<rst_epilog>', lineno)
-
- def read(self): # type: ignore
- # type: () -> StringList
- inputstring = super().read()
- lines = string2lines(inputstring, convert_whitespace=True)
- content = StringList()
- for lineno, line in enumerate(lines):
- content.append(line, self.source_path, lineno)
-
- prepend_prolog(content, self.env.config.rst_prolog)
- append_epilog(content, self.env.config.rst_epilog)
-
- return content
-
- def count_docinfo_lines(self, content):
- # type: (StringList) -> int
- if len(content) == 0:
- return 0
- else:
- for lineno, line in enumerate(content.data):
- if not docinfo_re.match(line):
- break
- return lineno
-
-
class FiletypeNotFoundError(Exception):
pass