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-12-21 06:21:49 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-12-21 06:21:49 +0300
commitd47f38e22db5da29c6b3ccce6b213cdc169f0ecd (patch)
treee6ec96b88a836372f8689efe61ef1baf7769777e /sphinx/io.py
parent26a17eade449bfec74aabc6adc9b056d52aa3cf0 (diff)
parentacdcf81599d49de751811269cd428850605224a1 (diff)
Merge branch '2.0'
Diffstat (limited to 'sphinx/io.py')
-rw-r--r--sphinx/io.py27
1 files changed, 11 insertions, 16 deletions
diff --git a/sphinx/io.py b/sphinx/io.py
index f3e72733e..624a04246 100644
--- a/sphinx/io.py
+++ b/sphinx/io.py
@@ -18,7 +18,8 @@ from docutils.readers import standalone
from docutils.transforms.references import DanglingReferences
from docutils.writers import UnfilteredWriter
-from sphinx.deprecation import RemovedInSphinx40Warning
+from sphinx.errors import FiletypeNotFoundError
+from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias
from sphinx.transforms import (
AutoIndexUpgrader, DoctreeReadEvent, FigureAligner, SphinxTransformer
)
@@ -26,7 +27,7 @@ from sphinx.transforms.i18n import (
PreserveTranslatableMessages, Locale, RemoveTranslatableInline,
)
from sphinx.transforms.references import SphinxDomains
-from sphinx.util import logging
+from sphinx.util import logging, get_filetype
from sphinx.util import UnicodeDecodeErrorHandler
from sphinx.util.docutils import LoggingReporter
from sphinx.versioning import UIDTransform
@@ -192,20 +193,6 @@ class SphinxFileInput(FileInput):
super().__init__(*args, **kwargs)
-class FiletypeNotFoundError(Exception):
- pass
-
-
-def get_filetype(source_suffix, filename):
- # type: (Dict[str, str], str) -> str
- for suffix, filetype in source_suffix.items():
- if filename.endswith(suffix):
- # If default filetype (None), considered as restructuredtext.
- return filetype or 'restructuredtext'
- else:
- raise FiletypeNotFoundError
-
-
def read_doc(app, env, filename):
# type: (Sphinx, BuildEnvironment, str) -> nodes.document
"""Parse a document and convert to doctree."""
@@ -249,3 +236,11 @@ def read_doc(app, env, filename):
pub.publish()
return pub.document
+
+
+deprecated_alias('sphinx.io',
+ {
+ 'FiletypeNotFoundError': FiletypeNotFoundError,
+ 'get_filetype': get_filetype,
+ },
+ RemovedInSphinx40Warning)