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


Python HTMLTranslator.depart_title方法代码示例

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


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

示例1: depart_title

# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import depart_title [as 别名]
    def depart_title(self, node):
        close_tag = self.context[-1]
        if (self.permalink_text and self.builder.add_permalinks and node.parent.hasattr('ids') and node.parent['ids']):
            aname = ''
            for id in node.parent['ids']:
                if self.builder.env.domaindata['std']['labels'].has_key(id):
                    ref_text = '. Label :ref:`%s`' % id
                    aname = id
                    break
            if aname:
                link_text = ':ref:'
            else:
                ref_text = ''
                aname = node.parent['ids'][0]
                link_text = self.permalink_text


            # add permalink anchor
            if close_tag.startswith('</h'):
                what = u'<a class="headerlink" href="#%s" ' % aname + u'title="%s">%s</a>' % (
                    _('Permalink to this headline') + ref_text, link_text)
                if 0:
                    print 'what:', repr(what)
                    print 'aname:', repr(aname)
                self.body.append(what)
            elif close_tag.startswith('</a></h'):
                what = u'</a><a class="headerlink" href="#%s" ' % aname + u'title="%s">%s' % (
                    _('Permalink to this headline') + ref_text, link_text)
                if 0:
                    print 'what:', repr(what)
                    print 'aname:', repr(aname)
                self.body.append(what)

        HTMLTranslator.depart_title(self, node)
开发者ID:marble,项目名称:typo3-ExtendingSphinxForTYPO3,代码行数:36,代码来源:t3htmlwriter.py

示例2: depart_title

# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import depart_title [as 别名]
 def depart_title(self, node):
     if node.parent.hasattr('ids') and node.parent['ids'] and \
         self.section_level == 2:
         print "TITLE",self.section_level,node.parent['ids'][0]
         #self._title = node.parent['ids'][0]
         self._title = striptags(''.join(self.body[1:]))
         print "\t",str(node)[:50]
         print "\tBODY", self.body[:4]
     HTMLTranslator.depart_title(self, node)
开发者ID:nvdnkpr,项目名称:rst2epub2,代码行数:11,代码来源:sphinxext.py

示例3: depart_title

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

        if self.current_slide and isinstance(node.parent, (nodes.section, slide)):
            self.current_slide.title = "".join(self.body)
            self.pop_body()
        else:
            HTMLTranslator.depart_title(self, node)
            title = "".join(self.body)
            self.pop_body()
            self.body.append(title)
开发者ID:harrisonfeng,项目名称:hieroglyph,代码行数:12,代码来源:writer.py

示例4: depart_title

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

        if node.parent.hasattr("ids") and node.parent["ids"]:
            aname = node.parent["ids"][0]

            if self.builder.app.config.slide_link_to_html:
                self.body.append(
                    u'<a class="headerlink" href="%s#%s" ' % (html.html_path(self.builder), aname)
                    + u'title="%s">%s</a>' % (_("View HTML"), self.builder.app.config.slide_html_slide_link_symbol)
                )

        HTMLTranslator.depart_title(self, node)
开发者ID:prodigeni,项目名称:hieroglyph,代码行数:14,代码来源:writer.py

示例5: depart_title

# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import depart_title [as 别名]
 def depart_title(self, node):
     # print "--TITLE", node.text
     if not self._title:
         self._title = striptags(''.join(self.body[1:]))
     print "\n\n**title", self.section_level, ''.join(self.body[1:])[:150]
     low_level = self.section_level \
         <= int(self.builder.config.mobi_chapter_level)
     if node.parent.getattr('ids', False) and low_level:
         print "TITLE", self.section_level, node.parent['ids'][0]
         self._title = striptags(''.join(self.body[1:]))
         print "\t", str(node)[:50]
         print "\tBODY", self.body[:4]
     else:
         print "FALSE"
     HTMLTranslator.depart_title(self, node)
开发者ID:mattharrison,项目名称:rst2epub2,代码行数:17,代码来源:sphinxext.py

示例6: depart_title

# 需要导入模块: from sphinx.writers.html import HTMLTranslator [as 别名]
# 或者: from sphinx.writers.html.HTMLTranslator import depart_title [as 别名]
def depart_title(self, node):
  BaseTranslator.depart_title(self, node)
  h_level = self.section_level + self.initial_header_level - 1
  if h_level == 1: del self.body[1:]
开发者ID:nnabeyang,项目名称:hooktail_docs,代码行数:6,代码来源:hooktail.py


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