本文整理汇总了Python中docutils.writers.html4css1.HTMLTranslator方法的典型用法代码示例。如果您正苦于以下问题:Python html4css1.HTMLTranslator方法的具体用法?Python html4css1.HTMLTranslator怎么用?Python html4css1.HTMLTranslator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类docutils.writers.html4css1
的用法示例。
在下文中一共展示了html4css1.HTMLTranslator方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import HTMLTranslator [as 别名]
def __init__(self, *args):
html4css1.HTMLTranslator.__init__(self, *args)
#insert S5-specific stylesheet and script stuff:
self.theme_file_path = None
self.setup_theme()
view_mode = self.document.settings.view_mode
control_visibility = ('visible', 'hidden')[self.document.settings
.hidden_controls]
self.stylesheet.append(self.s5_stylesheet_template
% {'path': self.theme_file_path,
'view_mode': view_mode,
'control_visibility': control_visibility})
if not self.document.settings.current_slide:
self.stylesheet.append(self.disable_current_slide)
self.add_meta('<meta name="version" content="S5 1.1" />\n')
self.s5_footer = []
self.s5_header = []
self.section_count = 0
self.theme_files_copied = None
示例2: visit_subtitle
# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import HTMLTranslator [as 别名]
def visit_subtitle(self, node):
if isinstance(node.parent, nodes.section):
level = self.section_level + self.initial_header_level - 1
if level == 1:
level = 2
tag = 'h%s' % level
self.body.append(self.starttag(node, tag, ''))
self.context.append('</%s>\n' % tag)
else:
html4css1.HTMLTranslator.visit_subtitle(self, node)
示例3: visit_title
# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import HTMLTranslator [as 别名]
def visit_title(self, node):
html4css1.HTMLTranslator.visit_title(self, node)
示例4: depart_field_list
# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import HTMLTranslator [as 别名]
def depart_field_list(self, node):
html4css1.HTMLTranslator.depart_field_list(self, node)
if 'rfc2822' in node['classes']:
self.body.append('<hr />\n')
示例5: starttag
# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import HTMLTranslator [as 别名]
def starttag(self, node, tagname, suffix='\n', empty=False, **attributes):
""" Ensures all links to outside this instance of INGInious have target='_blank' """
if tagname == 'a' and "href" in attributes and not attributes["href"].startswith('#'):
attributes["target"] = "_blank"
if 'path' in web.ctx and '/lti/' in web.ctx.path:
if tagname == 'a' and 'href' in attributes:
attributes['href'] = self.rewrite_lti_url(attributes['href'])
elif tagname == 'img' and 'src' in attributes:
attributes['src'] = self.rewrite_lti_url(attributes['src'])
return html4css1.HTMLTranslator.starttag(self, node, tagname, suffix, empty, **attributes)