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


Python HTMLTranslator.visit_title方法代码示例

本文整理汇总了Python中sphinx.writers.html.HTMLTranslator.visit_title方法的典型用法代码示例。如果您正苦于以下问题:Python HTMLTranslator.visit_title方法的具体用法?Python HTMLTranslator.visit_title怎么用?Python HTMLTranslator.visit_title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sphinx.writers.html.HTMLTranslator的用法示例。


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

示例1: visit_title

# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import visit_title [as 别名]
    def visit_title(self, node):
        if isinstance(node.parent, nodes.section):
            level = self.section_level + self.initial_header_level - 1

            tag = 'h%s' % level
            self.body.append(self.starttag(node, tag, ''))
            self.context.append('</%s>\n' % tag)
        else:
            HTMLTranslator.visit_title(self, node)
开发者ID:AndreaCrotti,项目名称:hieroglyph,代码行数:11,代码来源:writer.py

示例2: visit_title

# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import visit_title [as 别名]
    def visit_title(self, node):

        if isinstance(node.parent, slide) or node.parent.attributes.get("include-as-slide", False):
            slide_level = node.parent.attributes.get("level", self.section_level)
            level = max(slide_level + self.initial_header_level - 1, 1)

            tag = "h%s" % level
            self.body.append(self.starttag(node, tag, ""))
            self.context.append("</%s>\n" % tag)
        else:
            HTMLTranslator.visit_title(self, node)
开发者ID:prodigeni,项目名称:hieroglyph,代码行数:13,代码来源:writer.py

示例3: visit_title

# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import visit_title [as 别名]
    def visit_title(self, node):
        if isinstance(node.parent, nodes.section) and not self.builder.has_title(self.document):
            h_level = self.section_level + self.initial_header_level - 1
            if h_level == 1:
                # Confluence take first title for page title from rst
                # It use for making internal links
                self.builder.set_title(self.document, node.children[0])

                # ignore first header; document must have title header
                raise nodes.SkipNode

        HTMLTranslator.visit_title(self, node)
开发者ID:chadmv,项目名称:sphinx-confluence,代码行数:14,代码来源:__init__.py

示例4: visit_title

# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import visit_title [as 别名]
    def visit_title(self, node):

        if (isinstance(node.parent, slide) or
                node.parent.attributes.get('include-as-slide', False)):
            slide_level = node.parent.attributes.get(
                'level',
                self.section_level)
            level = max(
                slide_level + self.initial_header_level - 1,
                1,
            )

            tag = 'h%s' % level
            self.body.append(self.starttag(node, tag, ''))
            self.context.append('</%s>\n' % tag)
        else:
            HTMLTranslator.visit_title(self, node)
开发者ID:timtan,项目名称:hieroglyph,代码行数:19,代码来源:writer.py

示例5: visit_title

# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import visit_title [as 别名]
    def visit_title(self, node):

        self.push_body()

        if isinstance(node.parent, slide) or node.parent.attributes.get("include-as-slide", False):
            slide_level = node.parent.attributes.get("level", self.section_level)
            level = max(slide_level + self.initial_header_level - 1, 1)
            self.current_slide.level = level

            # tag = 'h%s' % level
            # self.body.append(self.starttag(node, tag, ''))
            # self.context.append('</%s>\n' % tag)

        if self.current_slide and isinstance(node.parent, (nodes.section, slide)):
            self.current_slide.title = node.astext().strip()
        else:
            HTMLTranslator.visit_title(self, node)
开发者ID:harrisonfeng,项目名称:hieroglyph,代码行数:19,代码来源:writer.py

示例6: visit_title

# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import visit_title [as 别名]
    def visit_title(self, node):
        if not isinstance(node.parent, nodes.section):
            HTMLTranslator.visit_title(self, node)
            return

        h_level = self.section_level + self.initial_header_level - 1
        atts = {}
        if (len(node.parent) >= 2 and
            isinstance(node.parent[1], nodes.subtitle)):
            atts['CLASS'] = 'with-subtitle'
        self.body.append(self.starttag(node, 'h%s' % h_level, '', **atts))
        ids = node.parent.get('ids', [])
        for id_ in ids:
            self.body.append('<span id="%s" class="bookmark"></span>' % id_)
        atts = {}
        if node.hasattr('refid'):
            atts['class'] = 'toc-backref'
            atts['href'] = '#' + node['refid']
        if atts:
            self.body.append(self.starttag({}, 'a', '', **atts))
            close_tag = '</a></h%s>\n' % (h_level)
        else:
            close_tag = '</h%s>\n' % (h_level)
        self.context.append(close_tag)
开发者ID:rloomba,项目名称:balanced-docs,代码行数:26,代码来源:htmlwriter.py

示例7: visit_title

# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import visit_title [as 别名]
 def visit_title(self, node):
     if self.section_level == 1:
         raise nodes.SkipNode
     HTMLTranslator.visit_title(self, node)
开发者ID:Batur24,项目名称:isso,代码行数:6,代码来源:remove_heading.py


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