本文整理汇总了Python中sphinx.builders.html.StandaloneHTMLBuilder.imgpath方法的典型用法代码示例。如果您正苦于以下问题:Python StandaloneHTMLBuilder.imgpath方法的具体用法?Python StandaloneHTMLBuilder.imgpath怎么用?Python StandaloneHTMLBuilder.imgpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sphinx.builders.html.StandaloneHTMLBuilder
的用法示例。
在下文中一共展示了StandaloneHTMLBuilder.imgpath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_images
# 需要导入模块: from sphinx.builders.html import StandaloneHTMLBuilder [as 别名]
# 或者: from sphinx.builders.html.StandaloneHTMLBuilder import imgpath [as 别名]
def test_images():
assert warning_emitted('images', 'image file not readable: foo.png')
assert warning_emitted('images', 'nonlocal image URI found: '
'http://www.python.org/logo.png')
tree = env.get_doctree('images')
app._warning.reset()
htmlbuilder = StandaloneHTMLBuilder(app)
htmlbuilder.imgpath = 'dummy'
htmlbuilder.post_process_images(tree)
image_uri_message = "no matching candidate for image URI u'foo.*'"
if PY3:
image_uri_message = remove_unicode_literals(image_uri_message)
assert image_uri_message in app._warning.content[-1]
assert set(htmlbuilder.images.keys()) == \
set(['subdir/img.png', 'img.png', 'subdir/simg.png', 'svgimg.svg'])
assert set(htmlbuilder.images.values()) == \
set(['img.png', 'img1.png', 'simg.png', 'svgimg.svg'])
app._warning.reset()
latexbuilder = LaTeXBuilder(app)
latexbuilder.post_process_images(tree)
assert image_uri_message in app._warning.content[-1]
assert set(latexbuilder.images.keys()) == \
set(['subdir/img.png', 'subdir/simg.png', 'img.png', 'img.pdf',
'svgimg.pdf'])
assert set(latexbuilder.images.values()) == \
set(['img.pdf', 'img.png', 'img1.png', 'simg.png', 'svgimg.pdf'])
示例2: test_images
# 需要导入模块: from sphinx.builders.html import StandaloneHTMLBuilder [as 别名]
# 或者: from sphinx.builders.html.StandaloneHTMLBuilder import imgpath [as 别名]
def test_images(app):
app.build()
assert ('image file not readable: foo.png'
in app._warning.getvalue())
tree = app.env.get_doctree('images')
htmlbuilder = StandaloneHTMLBuilder(app)
htmlbuilder.set_environment(app.env)
htmlbuilder.init()
htmlbuilder.imgpath = 'dummy'
htmlbuilder.post_process_images(tree)
assert set(htmlbuilder.images.keys()) == \
set(['subdir/img.png', 'img.png', 'subdir/simg.png', 'svgimg.svg',
'img.foo.png'])
assert set(htmlbuilder.images.values()) == \
set(['img.png', 'img1.png', 'simg.png', 'svgimg.svg', 'img.foo.png'])
latexbuilder = LaTeXBuilder(app)
latexbuilder.set_environment(app.env)
latexbuilder.init()
latexbuilder.post_process_images(tree)
assert set(latexbuilder.images.keys()) == \
set(['subdir/img.png', 'subdir/simg.png', 'img.png', 'img.pdf',
'svgimg.pdf', 'img.foo.png'])
assert set(latexbuilder.images.values()) == \
set(['img.pdf', 'img.png', 'img1.png', 'simg.png',
'svgimg.pdf', 'img.foo.png'])
示例3: test_images
# 需要导入模块: from sphinx.builders.html import StandaloneHTMLBuilder [as 别名]
# 或者: from sphinx.builders.html.StandaloneHTMLBuilder import imgpath [as 别名]
def test_images():
assert warning_emitted("images", "image file not readable: foo.png")
assert warning_emitted("images", "nonlocal image URI found: " "http://www.python.org/logo.png")
tree = env.get_doctree("images")
app._warning.reset()
htmlbuilder = StandaloneHTMLBuilder(app)
htmlbuilder.imgpath = "dummy"
htmlbuilder.post_process_images(tree)
assert set(htmlbuilder.images.keys()) == set(
["subdir/img.png", "img.png", "subdir/simg.png", "svgimg.svg", "img.foo.png"]
)
assert set(htmlbuilder.images.values()) == set(["img.png", "img1.png", "simg.png", "svgimg.svg", "img.foo.png"])
app._warning.reset()
latexbuilder = LaTeXBuilder(app)
latexbuilder.post_process_images(tree)
assert set(latexbuilder.images.keys()) == set(
["subdir/img.png", "subdir/simg.png", "img.png", "img.pdf", "svgimg.pdf", "img.foo.png"]
)
assert set(latexbuilder.images.values()) == set(
["img.pdf", "img.png", "img1.png", "simg.png", "svgimg.pdf", "img.foo.png"]
)