当前位置: 首页>>代码示例>>Python>>正文


Python StandaloneHTMLBuilder.imgpath方法代码示例

本文整理汇总了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'])
开发者ID:lehmannro,项目名称:sphinx-mirror,代码行数:30,代码来源:test_environment.py

示例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'])
开发者ID:olivier-heurtier,项目名称:sphinx,代码行数:29,代码来源:test_environment.py

示例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"]
    )
开发者ID:TimKam,项目名称:sphinx,代码行数:25,代码来源:test_environment.py


注:本文中的sphinx.builders.html.StandaloneHTMLBuilder.imgpath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。