mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Reduce DeprecationWarning
This commit is contained in:
parent
22e7380a70
commit
d63a678228
@ -85,40 +85,37 @@ class Epub3Builder(_epub_base.EpubBuilder):
|
||||
def validate_config_value(self):
|
||||
# <package> lang attribute, dc:language
|
||||
if not self.app.config.epub_language:
|
||||
self.app.warn(
|
||||
'conf value "epub_language" (or "language") '
|
||||
'should not be empty for EPUB3')
|
||||
logger.warning('conf value "epub_language" (or "language") '
|
||||
'should not be empty for EPUB3')
|
||||
# <package> unique-identifier attribute
|
||||
if not xmlname_checker().match(self.app.config.epub_uid):
|
||||
self.app.warn('conf value "epub_uid" should be XML NAME for EPUB3')
|
||||
logger.warning('conf value "epub_uid" should be XML NAME for EPUB3')
|
||||
# dc:title
|
||||
if not self.app.config.epub_title:
|
||||
self.app.warn(
|
||||
'conf value "epub_title" (or "html_title") '
|
||||
'should not be empty for EPUB3')
|
||||
logger.warning('conf value "epub_title" (or "html_title") '
|
||||
'should not be empty for EPUB3')
|
||||
# dc:creator
|
||||
if not self.app.config.epub_author:
|
||||
self.app.warn('conf value "epub_author" should not be empty for EPUB3')
|
||||
logger.warning('conf value "epub_author" should not be empty for EPUB3')
|
||||
# dc:contributor
|
||||
if not self.app.config.epub_contributor:
|
||||
self.app.warn('conf value "epub_contributor" should not be empty for EPUB3')
|
||||
logger.warning('conf value "epub_contributor" should not be empty for EPUB3')
|
||||
# dc:description
|
||||
if not self.app.config.epub_description:
|
||||
self.app.warn('conf value "epub_description" should not be empty for EPUB3')
|
||||
logger.warning('conf value "epub_description" should not be empty for EPUB3')
|
||||
# dc:publisher
|
||||
if not self.app.config.epub_publisher:
|
||||
self.app.warn('conf value "epub_publisher" should not be empty for EPUB3')
|
||||
logger.warning('conf value "epub_publisher" should not be empty for EPUB3')
|
||||
# dc:rights
|
||||
if not self.app.config.epub_copyright:
|
||||
self.app.warn(
|
||||
'conf value "epub_copyright" (or "copyright")'
|
||||
'should not be empty for EPUB3')
|
||||
logger.warning('conf value "epub_copyright" (or "copyright")'
|
||||
'should not be empty for EPUB3')
|
||||
# dc:identifier
|
||||
if not self.app.config.epub_identifier:
|
||||
self.app.warn('conf value "epub_identifier" should not be empty for EPUB3')
|
||||
logger.warning('conf value "epub_identifier" should not be empty for EPUB3')
|
||||
# meta ibooks:version
|
||||
if not self.app.config.version:
|
||||
self.app.warn('conf value "version" should not be empty for EPUB3')
|
||||
logger.warning('conf value "version" should not be empty for EPUB3')
|
||||
|
||||
def content_metadata(self):
|
||||
# type: () -> Dict
|
||||
|
@ -605,7 +605,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
|
||||
# additional pages from conf.py
|
||||
for pagename, template in self.config.html_additional_pages.items():
|
||||
self.info(' ' + pagename, nonl=1)
|
||||
logger.info(' ' + pagename, nonl=1)
|
||||
self.handle_page(pagename, {}, template)
|
||||
|
||||
# the search page
|
||||
@ -1188,7 +1188,7 @@ class SingleFileHTMLBuilder(StandaloneHTMLBuilder):
|
||||
|
||||
# additional pages from conf.py
|
||||
for pagename, template in self.config.html_additional_pages.items():
|
||||
self.info(' ' + pagename, nonl=1)
|
||||
logger.info(' ' + pagename, nonl=1)
|
||||
self.handle_page(pagename, {}, template)
|
||||
|
||||
if self.config.html_use_opensearch:
|
||||
|
@ -46,7 +46,7 @@ def test_sectioning(app, status, warning):
|
||||
|
||||
app.builder.build(['only'])
|
||||
doctree = app.env.get_doctree('only')
|
||||
process_only_nodes(doctree, app.builder.tags)
|
||||
app.env.apply_post_transforms(doctree, 'only')
|
||||
|
||||
parts = [getsects(n)
|
||||
for n in [_n for _n in doctree.children if isinstance(_n, nodes.section)]]
|
||||
|
@ -14,6 +14,7 @@ from docutils.nodes import bullet_list, list_item, caption, comment, reference
|
||||
from sphinx import addnodes
|
||||
from sphinx.addnodes import compact_paragraph, only
|
||||
from sphinx.builders.html import StandaloneHTMLBuilder
|
||||
from sphinx.environment.adapters.toctree import TocTree
|
||||
import pytest
|
||||
|
||||
from sphinx.testing.util import assert_node
|
||||
@ -138,7 +139,7 @@ def test_glob(app):
|
||||
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
|
||||
def test_get_toc_for(app):
|
||||
app.build()
|
||||
toctree = app.env.get_toc_for('index', app.builder)
|
||||
toctree = TocTree(app.env).get_toc_for('index', app.builder)
|
||||
|
||||
assert_node(toctree,
|
||||
[bullet_list, ([list_item, (compact_paragraph, # [0][0]
|
||||
@ -165,7 +166,7 @@ def test_get_toc_for(app):
|
||||
def test_get_toc_for_only(app):
|
||||
app.build()
|
||||
builder = StandaloneHTMLBuilder(app)
|
||||
toctree = app.env.get_toc_for('index', builder)
|
||||
toctree = TocTree(app.env).get_toc_for('index', builder)
|
||||
|
||||
assert_node(toctree,
|
||||
[bullet_list, ([list_item, (compact_paragraph, # [0][0]
|
||||
@ -194,7 +195,7 @@ def test_get_toc_for_only(app):
|
||||
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
|
||||
def test_get_toc_for_tocdepth(app):
|
||||
app.build()
|
||||
toctree = app.env.get_toc_for('tocdepth', app.builder)
|
||||
toctree = TocTree(app.env).get_toc_for('tocdepth', app.builder)
|
||||
|
||||
assert_node(toctree,
|
||||
[bullet_list, list_item, (compact_paragraph, # [0][0]
|
||||
@ -209,7 +210,7 @@ def test_get_toc_for_tocdepth(app):
|
||||
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
|
||||
def test_get_toctree_for(app):
|
||||
app.build()
|
||||
toctree = app.env.get_toctree_for('index', app.builder, collapse=False)
|
||||
toctree = TocTree(app.env).get_toctree_for('index', app.builder, collapse=False)
|
||||
assert_node(toctree,
|
||||
[compact_paragraph, ([caption, "Table of Contents"],
|
||||
bullet_list,
|
||||
@ -246,7 +247,7 @@ def test_get_toctree_for(app):
|
||||
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
|
||||
def test_get_toctree_for_collapse(app):
|
||||
app.build()
|
||||
toctree = app.env.get_toctree_for('index', app.builder, collapse=True)
|
||||
toctree = TocTree(app.env).get_toctree_for('index', app.builder, collapse=True)
|
||||
assert_node(toctree,
|
||||
[compact_paragraph, ([caption, "Table of Contents"],
|
||||
bullet_list,
|
||||
@ -274,7 +275,7 @@ def test_get_toctree_for_collapse(app):
|
||||
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
|
||||
def test_get_toctree_for_maxdepth(app):
|
||||
app.build()
|
||||
toctree = app.env.get_toctree_for('index', app.builder, collapse=False, maxdepth=3)
|
||||
toctree = TocTree(app.env).get_toctree_for('index', app.builder, collapse=False, maxdepth=3)
|
||||
assert_node(toctree,
|
||||
[compact_paragraph, ([caption, "Table of Contents"],
|
||||
bullet_list,
|
||||
@ -316,8 +317,8 @@ def test_get_toctree_for_maxdepth(app):
|
||||
@pytest.mark.test_params(shared_result='test_environment_toctree_basic')
|
||||
def test_get_toctree_for_includehidden(app):
|
||||
app.build()
|
||||
toctree = app.env.get_toctree_for('index', app.builder, collapse=False,
|
||||
includehidden=False)
|
||||
toctree = TocTree(app.env).get_toctree_for('index', app.builder, collapse=False,
|
||||
includehidden=False)
|
||||
assert_node(toctree,
|
||||
[compact_paragraph, ([caption, "Table of Contents"],
|
||||
bullet_list,
|
||||
|
Loading…
Reference in New Issue
Block a user