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


Python html.SmartyPantsHTMLTranslator类代码示例

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


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

示例1: visit_section

 def visit_section(self, node):
     '''Give each section a unique ID -- nice for custom CSS hooks'''
     old_ids = node.get('ids', [])
     node['ids'] = ['s-' + i for i in old_ids]
     node['ids'].extend(old_ids)
     SmartyPantsHTMLTranslator.visit_section(self, node)
     node['ids'] = old_ids
开发者ID:alvaromartin,项目名称:baph,代码行数:7,代码来源:djangodocs.py

示例2: visit_section

 def visit_section(self, node):
     old_ids = node.get('ids', [])
     node['ids'] = ['s-' + i for i in old_ids]
     node['ids'].extend(old_ids)
     SmartyPantsHTMLTranslator.visit_section(self, node)
     node['ids'] = old_ids
开发者ID:creativify,项目名称:merengueproj,代码行数:6,代码来源:merenguedocs.py

示例3: visit_literal_block

 def visit_literal_block(self, node):
     self.no_smarty += 1
     SmartyPantsHTMLTranslator.visit_literal_block(self, node)
开发者ID:creativify,项目名称:merengueproj,代码行数:3,代码来源:merenguedocs.py

示例4: depart_literal_block

 def depart_literal_block(self, node):
     SmartyPantsHTMLTranslator.depart_literal_block(self, node)
     self.no_smarty -= 1
开发者ID:creativify,项目名称:merengueproj,代码行数:3,代码来源:merenguedocs.py

示例5: __init__

 def __init__(self, *args, **kwargs):
     SmartyPantsHTMLTranslator.__init__(self, *args, **kwargs)
开发者ID:i386x,项目名称:doit,代码行数:2,代码来源:conf.py

示例6: __init__

  def __init__(self, builder, *args, **kwds):
    # HTMLTranslator is an old-style Python class, so 'super' doesn't work: use
    # direct parent invocation.
    HTMLTranslator.__init__(self, builder, *args, **kwds)

    self.within_ignored_h1 = False
    self.within_toc = False
开发者ID:7kbird,项目名称:chrome,代码行数:7,代码来源:devsite_builder.py

示例7: visit_reference

 def visit_reference(self, node):
   # In "kill_internal_links" mode, we don't emit the actual links for internal
   # nodes.
   if self.builder.kill_internal_links and node.get('internal'):
     pass
   else:
     HTMLTranslator.visit_reference(self, node)
开发者ID:7kbird,项目名称:chrome,代码行数:7,代码来源:devsite_builder.py

示例8: visit_title

  def visit_title(self, node):
    if isinstance(node.parent, nodes.section):
      # Steal the id from the parent. This is used in chromesite to handle the
      # auto-generated navbar and permalinks.
      if node.parent.hasattr('ids'):
        node['ids'] = node.parent['ids'][:]

    HTMLTranslator.visit_title(self, node)
开发者ID:7kbird,项目名称:chrome,代码行数:8,代码来源:chromesite_builder.py

示例9: visit_topic

 def visit_topic(self, node):
   if 'contents' in node['classes']:
     # TODO(binji):
     # Detect a TOC: we want to hide these from chromesite, but still keep
     # them in devsite. An easy hack is to add display: none to the element
     # here.
     # When we remove devsite support, we can remove this hack.
     self.within_toc = True
     attrs = {'style': 'display: none'}
     self.body.append(self.starttag(node, 'div', **attrs))
   else:
     HTMLTranslator.visit_topic(self, node)
开发者ID:7kbird,项目名称:chrome,代码行数:12,代码来源:chromesite_builder.py

示例10: visit_title

  def visit_title(self, node):
    # Why this?
    #
    # Sphinx insists on inserting a <h1>Page Title</h1> into the page, but this
    # is not how the devsite wants it. The devsite inserts the page title on
    # its own, the the extra h1 is duplication.
    #
    # Killing the doctree title node in a custom transform doesn't work, because
    # Sphinx explicitly looks for it when writing a document. So instead we rig
    # the HTML produced.
    #
    # When a title node is visited, and this is the h1-to-be, we ignore it and
    # also set a flag that tells visit_Text not to print the actual text of the
    # header.

    # The h1 node is in the section whose parent is the document itself. Other
    # sections have this top-section as their parent.
    if (node.parent and node.parent.parent and
        isinstance(node.parent.parent, nodes.document)):
      # Internal flag. Also, nothing is pushed to the context. Our depart_title
      # doesn't pop anything when this flag is set.
      self.within_ignored_h1 = True
    else:
      HTMLTranslator.visit_title(self, node)
开发者ID:7kbird,项目名称:chrome,代码行数:24,代码来源:devsite_builder.py

示例11: visit_Text

 def visit_Text(self, node):
   if not self.within_ignored_h1:
     HTMLTranslator.visit_Text(self, node)
开发者ID:7kbird,项目名称:chrome,代码行数:3,代码来源:devsite_builder.py

示例12: visit_paragraph

 def visit_paragraph(self, node):
   # Don't generate <p>s within the table of contents
   if not self.within_toc:
     HTMLTranslator.visit_paragraph(self, node)
开发者ID:7kbird,项目名称:chrome,代码行数:4,代码来源:devsite_builder.py

示例13: depart_title

 def depart_title(self, node):
   if not self.within_ignored_h1:
     HTMLTranslator.depart_title(self, node)
   self.within_ignored_h1 = False
开发者ID:7kbird,项目名称:chrome,代码行数:4,代码来源:devsite_builder.py

示例14: depart_topic

 def depart_topic(self, node):
   if self.within_toc:
     self.body.append('\n</div>')
   else:
     HTMLTranslator.visit_topic(self, node)
开发者ID:7kbird,项目名称:chrome,代码行数:5,代码来源:chromesite_builder.py

示例15: depart_reference

 def depart_reference(self, node):
   if self.builder.kill_internal_links and node.get('internal'):
     pass
   else:
     HTMLTranslator.depart_reference(self, node)
开发者ID:7kbird,项目名称:chrome,代码行数:5,代码来源:devsite_builder.py


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