mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Deprecate: html5_ready and is_html5_writer_available()
This commit is contained in:
parent
7970e6c044
commit
3aa7e4105a
2
CHANGES
2
CHANGES
@ -53,6 +53,8 @@ Deprecated
|
|||||||
required
|
required
|
||||||
* The ``language`` argument of ``sphinx.util.i18n:format_date()`` becomes
|
* The ``language`` argument of ``sphinx.util.i18n:format_date()`` becomes
|
||||||
required
|
required
|
||||||
|
* ``sphinx.builders.html.html5_ready``
|
||||||
|
* ``sphinx.util.docutils.is_html5_writer_available()``
|
||||||
* ``sphinx.writers.latex.LaTeXWriter.docclasses``
|
* ``sphinx.writers.latex.LaTeXWriter.docclasses``
|
||||||
|
|
||||||
Features added
|
Features added
|
||||||
|
@ -42,6 +42,16 @@ The following is a list of deprecated interfaces.
|
|||||||
- 7.0
|
- 7.0
|
||||||
- N/A
|
- N/A
|
||||||
|
|
||||||
|
* - ``sphinx.builders.html.html5_ready``
|
||||||
|
- 5.0
|
||||||
|
- 7.0
|
||||||
|
- N/A
|
||||||
|
|
||||||
|
* - ``sphinx.util.docutils.is_html5_writer_available()``
|
||||||
|
- 5.0
|
||||||
|
- 7.0
|
||||||
|
- N/A
|
||||||
|
|
||||||
* - ``sphinx.writers.latex.LaTeXWriter.docclasses``
|
* - ``sphinx.writers.latex.LaTeXWriter.docclasses``
|
||||||
- 5.0
|
- 5.0
|
||||||
- 7.0
|
- 7.0
|
||||||
|
@ -23,6 +23,7 @@ from sphinx import version_info as sphinx_version
|
|||||||
from sphinx.application import Sphinx
|
from sphinx.application import Sphinx
|
||||||
from sphinx.builders import Builder
|
from sphinx.builders import Builder
|
||||||
from sphinx.config import ENUM, Config
|
from sphinx.config import ENUM, Config
|
||||||
|
from sphinx.deprecation import RemovedInSphinx70Warning, deprecated_alias
|
||||||
from sphinx.domains import Domain, Index, IndexEntry
|
from sphinx.domains import Domain, Index, IndexEntry
|
||||||
from sphinx.environment.adapters.asset import ImageAdapter
|
from sphinx.environment.adapters.asset import ImageAdapter
|
||||||
from sphinx.environment.adapters.indexentries import IndexEntries
|
from sphinx.environment.adapters.indexentries import IndexEntries
|
||||||
@ -33,7 +34,7 @@ from sphinx.locale import _, __
|
|||||||
from sphinx.search import js_index
|
from sphinx.search import js_index
|
||||||
from sphinx.theming import HTMLThemeFactory
|
from sphinx.theming import HTMLThemeFactory
|
||||||
from sphinx.util import isurl, logging, md5, progress_message, status_iterator
|
from sphinx.util import isurl, logging, md5, progress_message, status_iterator
|
||||||
from sphinx.util.docutils import is_html5_writer_available, new_document
|
from sphinx.util.docutils import new_document
|
||||||
from sphinx.util.fileutil import copy_asset
|
from sphinx.util.fileutil import copy_asset
|
||||||
from sphinx.util.i18n import format_date
|
from sphinx.util.i18n import format_date
|
||||||
from sphinx.util.inventory import InventoryFile
|
from sphinx.util.inventory import InventoryFile
|
||||||
@ -41,13 +42,7 @@ from sphinx.util.matching import DOTFILES, Matcher, patmatch
|
|||||||
from sphinx.util.osutil import copyfile, ensuredir, os_path, relative_uri
|
from sphinx.util.osutil import copyfile, ensuredir, os_path, relative_uri
|
||||||
from sphinx.util.tags import Tags
|
from sphinx.util.tags import Tags
|
||||||
from sphinx.writers.html import HTMLTranslator, HTMLWriter
|
from sphinx.writers.html import HTMLTranslator, HTMLWriter
|
||||||
|
from sphinx.writers.html5 import HTML5Translator
|
||||||
# HTML5 Writer is available or not
|
|
||||||
if is_html5_writer_available():
|
|
||||||
from sphinx.writers.html5 import HTML5Translator
|
|
||||||
html5_ready = True
|
|
||||||
else:
|
|
||||||
html5_ready = False
|
|
||||||
|
|
||||||
#: the filename for the inventory of objects
|
#: the filename for the inventory of objects
|
||||||
INVENTORY_FILENAME = 'objects.inv'
|
INVENTORY_FILENAME = 'objects.inv'
|
||||||
@ -344,7 +339,7 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def default_translator_class(self) -> Type[nodes.NodeVisitor]: # type: ignore
|
def default_translator_class(self) -> Type[nodes.NodeVisitor]: # type: ignore
|
||||||
if not html5_ready or self.config.html4_writer:
|
if self.config.html4_writer:
|
||||||
return HTMLTranslator
|
return HTMLTranslator
|
||||||
else:
|
else:
|
||||||
return HTML5Translator
|
return HTML5Translator
|
||||||
@ -536,7 +531,7 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
'parents': [],
|
'parents': [],
|
||||||
'logo': logo,
|
'logo': logo,
|
||||||
'favicon': favicon,
|
'favicon': favicon,
|
||||||
'html5_doctype': html5_ready and not self.config.html4_writer,
|
'html5_doctype': not self.config.html4_writer,
|
||||||
}
|
}
|
||||||
if self.theme:
|
if self.theme:
|
||||||
self.globalcontext.update(
|
self.globalcontext.update(
|
||||||
@ -1315,6 +1310,12 @@ import sphinxcontrib.serializinghtml # NOQA
|
|||||||
import sphinx.builders.dirhtml # NOQA
|
import sphinx.builders.dirhtml # NOQA
|
||||||
import sphinx.builders.singlehtml # NOQA
|
import sphinx.builders.singlehtml # NOQA
|
||||||
|
|
||||||
|
deprecated_alias('sphinx.builders.html',
|
||||||
|
{
|
||||||
|
'html5_ready': True,
|
||||||
|
},
|
||||||
|
RemovedInSphinx70Warning)
|
||||||
|
|
||||||
|
|
||||||
def setup(app: Sphinx) -> Dict[str, Any]:
|
def setup(app: Sphinx) -> Dict[str, Any]:
|
||||||
# builders
|
# builders
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import warnings
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from os import path
|
from os import path
|
||||||
@ -18,7 +19,8 @@ from docutils.parsers.rst.states import Inliner
|
|||||||
from docutils.statemachine import State, StateMachine, StringList
|
from docutils.statemachine import State, StateMachine, StringList
|
||||||
from docutils.utils import Reporter, unescape
|
from docutils.utils import Reporter, unescape
|
||||||
|
|
||||||
from sphinx.deprecation import RemovedInSphinx60Warning, deprecated_alias
|
from sphinx.deprecation import (RemovedInSphinx60Warning, RemovedInSphinx70Warning,
|
||||||
|
deprecated_alias)
|
||||||
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
|
||||||
@ -318,7 +320,9 @@ class NullReporter(Reporter):
|
|||||||
|
|
||||||
|
|
||||||
def is_html5_writer_available() -> bool:
|
def is_html5_writer_available() -> bool:
|
||||||
return docutils.__version_info__ > (0, 13, 0)
|
warnings.warn('is_html5_writer_available() is deprecated.',
|
||||||
|
RemovedInSphinx70Warning)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
Loading…
Reference in New Issue
Block a user