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

Python html.SmartyPantsHTMLTranslator类代码示例

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

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



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


示例16: depart_paragraph

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


示例17: visit_image

 def visit_image(self, node):
   # Paths to images in .rst sources should be absolute. This visitor does the
   # required transformation for the path to be correct in the final HTML.
   if self.builder.devsite_production_mode:
     node['uri'] = self.builder.get_production_url(node['uri'])
   HTMLTranslator.visit_image(self, node)
开发者ID:7kbird,项目名称:chrome,代码行数:6,代码来源:devsite_builder.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python latex.LaTeXWriter类代码示例发布时间:2022-05-27
下一篇:
Python html.HTMLWriter类代码示例发布时间: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