• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python html.StandaloneHTMLBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sphinx.builders.html.StandaloneHTMLBuilder的典型用法代码示例。如果您正苦于以下问题:Python StandaloneHTMLBuilder类的具体用法?Python StandaloneHTMLBuilder怎么用?Python StandaloneHTMLBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了StandaloneHTMLBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: write_doc

    def write_doc(self, docname, doctree):
        for node in doctree.traverse(nodes.reference):
            # add ``target=_blank`` attributes to external links
            if node.get('internal') is None and 'refuri' in node:
                node['target'] = '_blank'

        StandaloneHTMLBuilder.write_doc(self, docname, doctree)
开发者ID:Felix-neko,项目名称:sphinx,代码行数:7,代码来源:htmlhelp.py


示例2: init

 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for epub must be .html only
     self.out_suffix = '.xhtml'
     self.link_suffix = '.xhtml'
     self.playorder = 0
     self.tocid = 0
开发者ID:joostvanzwieten,项目名称:sphinx,代码行数:7,代码来源:epub.py


示例3: test_images

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,代码行数:28,代码来源:test_environment.py


示例4: init

    def init(self):
        StandaloneHTMLBuilder.init(self)

        # Pull project data from conf.py if it exists
        context = self.config.html_context
        if 'current_version' in context:
            self.version = context['current_version']
        if 'slug' in context:
            self.project = context['slug']

        # Put in our media files instead of putting them in the docs.
        for index, file in enumerate(self.script_files):
            if file in MEDIA_MAPPING.keys():
                self.script_files[index] = MEDIA_MAPPING[file] % context['MEDIA_URL']
                if file == "_static/jquery.js":
                    self.script_files.insert(index+1, "%sjavascript/jquery/jquery-migrate-1.2.1.min.js" % context['MEDIA_URL'])

        if 'html_theme' in context and context['html_theme'] == 'sphinx_rtd_theme':
            self.css_files.append('%scss/sphinx_rtd_theme.css' % context['MEDIA_URL'])
        else:
            self.css_files.append('%scss/badge_only.css' % context['MEDIA_URL'])

        # Analytics codes
        #self.script_files.append('_static/readthedocs-ext.js')
        #self.script_files.append('%sjavascript/analytics.js' % context['MEDIA_URL'])

        # We include the media servers version here so we can update rtd.js across all
        # documentation without rebuilding every one. 
        # If this script is embedded in each build, 
        # then updating the file across all docs is basically impossible.
        self.script_files.append('%sjavascript/readthedocs-doc-embed.js' % context['MEDIA_URL'])
        self.css_files.append('%scss/readthedocs-doc-embed.css' % context['MEDIA_URL'])
开发者ID:rvercesi,项目名称:readthedocs-sphinx-ext,代码行数:32,代码来源:readthedocs.py


示例5: init

 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for epub must be .html only
     self.out_suffix = '.xhtml'
     self.link_suffix = '.xhtml'
     self.playorder = 0
     self.tocid = 0
     self.use_index = self.get_builder_config('use_index', 'epub')
开发者ID:TimKam,项目名称:sphinx,代码行数:8,代码来源:epub.py


示例6: init

 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for HTML help must be .html only
     self.out_suffix = '.html'
     # determine the correct locale setting
     locale = chm_locales.get(self.config.language)
     if locale is not None:
         self.lcid, self.encoding = locale
开发者ID:cyberdaemon,项目名称:sphinx-docs,代码行数:8,代码来源:htmlhelp.py


示例7: handle_page

 def handle_page(self, pagename, addctx, templatename='page.html',
                 outfilename=None, event_arg=None):
     """Create a rendered page.
     This method is overwritten for genindex pages in order to fix
     href link attributes.
     """
     if pagename.startswith('genindex'):
         self.fix_genindex(addctx['genindexentries'])
     StandaloneHTMLBuilder.handle_page(self, pagename, addctx, templatename,
         outfilename, event_arg)
开发者ID:simonwex,项目名称:betafarm,代码行数:10,代码来源:epub.py


示例8: handle_page

    def handle_page(self, pagename, addctx, templatename="page.html", outfilename=None, event_arg=None):
        """Create a rendered page.

        This method is overwritten for genindex pages in order to fix href link
        attributes.
        """
        if pagename.startswith("genindex"):
            self.fix_genindex(addctx["genindexentries"])
        addctx["doctype"] = self.doctype
        StandaloneHTMLBuilder.handle_page(self, pagename, addctx, templatename, outfilename, event_arg)
开发者ID:trustin,项目名称:sphinx-maven-plugin,代码行数:10,代码来源:epub.py


示例9: init

 def init(self):
     # type: () -> None
     StandaloneHTMLBuilder.init(self)
     # the output files for epub must be .html only
     self.out_suffix = '.xhtml'
     self.link_suffix = '.xhtml'
     self.playorder = 0
     self.tocid = 0
     self.id_cache = {}  # type: Dict[unicode, unicode]
     self.use_index = self.get_builder_config('use_index', 'epub')
开发者ID:LFYG,项目名称:sphinx,代码行数:10,代码来源:_epub_base.py


示例10: write_doc

    def write_doc(self, docname, doctree):
        # type: (unicode, nodes.Node) -> None
        """Write one document file.

        This method is overwritten in order to fix fragment identifiers
        and to add visible external links.
        """
        self.fix_ids(doctree)
        self.add_visible_links(doctree, self.config.epub_show_urls)
        StandaloneHTMLBuilder.write_doc(self, docname, doctree)
开发者ID:LFYG,项目名称:sphinx,代码行数:10,代码来源:_epub_base.py


示例11: init

 def init(self):
     # type: () -> None
     # the output files for HTML help is .html by default
     self.out_suffix = '.html'
     self.link_suffix = '.html'
     StandaloneHTMLBuilder.init(self)
     # determine the correct locale setting
     locale = chm_locales.get(self.config.language)
     if locale is not None:
         self.lcid, self.encoding = locale
开发者ID:willingc,项目名称:sphinx,代码行数:10,代码来源:htmlhelp.py


示例12: test_images

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,代码行数:27,代码来源:test_environment.py


示例13: handle_page

    def handle_page(
        self,
        docname,
        addctx,
        templatename="page.html",
        outfilename=None,
        event_arg=None,
    ):
        self.toctree.initialize(self.env)

        lineage = self._get_page_lineage(docname)
        processed_lineage = self._process_page_lineage(docname, lineage)
        addctx["lineage"] = processed_lineage

        StandaloneHTMLBuilder.handle_page(self, docname, addctx, templatename=templatename, outfilename=outfilename, event_arg=event_arg)
开发者ID:mongodb,项目名称:docs-tools,代码行数:15,代码来源:stitch-builders.py


示例14: handle_page

    def handle_page(self, pagename, addctx, templatename='page.html',
                    outfilename=None, event_arg=None):
        # type: (unicode, Dict, unicode, unicode, Any) -> None
        """Create a rendered page.

        This method is overwritten for genindex pages in order to fix href link
        attributes.
        """
        if pagename.startswith('genindex') and 'genindexentries' in addctx:
            if not self.use_index:
                return
            self.fix_genindex(addctx['genindexentries'])
        addctx['doctype'] = self.doctype
        StandaloneHTMLBuilder.handle_page(self, pagename, addctx, templatename,
                                          outfilename, event_arg)
开发者ID:LFYG,项目名称:sphinx,代码行数:15,代码来源:_epub_base.py


示例15: write

  def write(self, build_docnames, updated_docnames, method='update'):
    names = build_docnames and updated_docnames and \
        build_docnames + updated_docnames or \
        build_docnames or updated_docnames

    if 'index' not in names:
      names.append('index')

    for docname in names:
      doctree = self.env.get_doctree(docname)
      nodes = doctree.traverse(addnodes.toctree)
      if nodes:
        self.toctrees[docname] = nodes

    StandaloneHTMLBuilder.write(
      self, build_docnames, updated_docnames, method=method
    )
开发者ID:DamienCassou,项目名称:eclim,代码行数:17,代码来源:builder.py


示例16: write_doc

 def write_doc(self, docname, doctree):
     """Write one document file.
     This method is overwritten in order to fix fragment identifiers
     and to add visible external links.
     """
     self.fix_ids(doctree)
     self.add_visible_links(doctree)
     return StandaloneHTMLBuilder.write_doc(self, docname, doctree)
开发者ID:simonwex,项目名称:betafarm,代码行数:8,代码来源:epub.py


示例17: init

    def init(self):
        StandaloneHTMLBuilder.init(self)

        # Pull project data from conf.py if it exists
        context = self.config.html_context
        if context.has_key('current_version'):
            self.version = context['current_version']
        if context.has_key('slug'):
            self.project = context['slug']

        self.storage = WebStorage(builder=self)

        # add our custom bits
        self.script_files.append('_static/jquery.pageslide.js')
        self.script_files.append('_static/websupport2-bundle.js')
        self.css_files.append('_static/websupport2.css')
        self.css_files.append('_static/sphinxweb.css')
        self.css_files.append('_static/jquery.pageslide.css')
开发者ID:ericholscher,项目名称:sphinx-websupport2,代码行数:18,代码来源:websupport2.py


示例18: test_images

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,代码行数:23,代码来源:test_environment.py


示例19: init

 def init(self):
     StandaloneHTMLBuilder.init(self)
     # the output files for mobi must be .html only
     self.out_suffix = '.html'
     self.playorder = 0
开发者ID:Voronenko,项目名称:projectdocs,代码行数:5,代码来源:mobi.py


示例20: init

 def init(self):
     # type: () -> None
     StandaloneHTMLBuilder.init(self)
     self.out_suffix = '.html'
     self.link_suffix = '.html'
开发者ID:mgeier,项目名称:sphinx,代码行数:5,代码来源:devhelp.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python config.Config类代码示例发布时间:2022-05-27
下一篇:
Python builders.Builder类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap