本文整理汇总了Python中lxml.html.builder.E.html方法的典型用法代码示例。如果您正苦于以下问题:Python E.html方法的具体用法?Python E.html怎么用?Python E.html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lxml.html.builder.E
的用法示例。
在下文中一共展示了E.html方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import html [as 别名]
def __init__(self, **kwargs):
super().__init__(**kwargs)
footer = E.footer(role='contentinfo', id='layout-footer')
content = E.main(role='main', id='layout-content')
header = E.header(role='banner', id='layout-header')
layout = E.div(header, content, footer, id='layout-wrapper')
body = E.body(layout)
head = E.head(prefix='og: http://ogp.me/ns#')
html = E.html(head, body, dir='rtl' if self.locale.rtl else 'ltr')
self.elements = Elements(html=html, head=head, body=body,
layout=layout, header=header, content=content, footer=footer)
self.meta = HTMLMeta()
self.links = HTMLLinks()
self.stylesheets = []
self.scripts = []
self.meta.app_name = self.handler.application.settings[
'application_name']
示例2: main
# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import html [as 别名]
#.........这里部分代码省略.........
# info("Wrap Section-Like Sequence of Blocks")
# cmd = local[str(BIN / "div.hs")]
# subinfo(cmd, "< json > json")
# try:
# json_str = (cmd << json_str)()
# except Exception as error:
# print(repr(error))
info("Wrap Section-Like Sequence of Blocks")
cmd = local[str(BIN / "section.hs")]
subinfo(cmd, "< json > json")
try:
json_str = (cmd << json_str)()
except Exception as error:
print(repr(error))
info("Flag Tombstones (end of proofs)")
cmd = local[str(BIN / "tombstone.hs")]
subinfo(cmd, "< json > json")
try:
json_str = (cmd << json_str)()
except Exception as error:
print(repr(error))
info("Convert Images to SVG Images")
cmd = local[str(BIN / "svg.hs")]
subinfo(cmd, "< json > json")
json_str = (cmd << json_str)()
info("Generate HTML body from markdown")
args = ["--email-obfuscation", "none",
"-f", "json",
"--mathjax",
"-t", "html5", "--section-divs"]
cmd = pandoc[args]
subinfo(cmd, "< json > body")
pandoc_body_str = (cmd << json_str)()
pandoc_html = lxml.html.document_fromstring(pandoc_body_str)
pandoc_body = pandoc_html.cssselect("body")[0]
info("Generate standalone HTML doc")
html = HTML.html(HTML.head, HTML.body)
body = html.cssselect("body")[0]
head = html.cssselect("head")[0]
head.append(HTML.meta(charset="utf-8"))
body.attrib.update(pandoc_body.attrib)
body.extend(pandoc_body[:])
# ----------------------------------------------------------------------
info("Add JQuery")
head.extend(jquery(standalone=standalone))
# ----------------------------------------------------------------------
info("Add Velocity")
head.extend(velocity(standalone=standalone))
# ----------------------------------------------------------------------
info("Add Clipboard.js")
head.extend(clipboard(standalone=standalone))
# ----------------------------------------------------------------------
info("Add Highlight.js")
head.extend(highlight(standalone=standalone))
# ----------------------------------------------------------------------
info("Add Google Fonts support")