本文整理汇总了Python中lxml.html.builder.E.script方法的典型用法代码示例。如果您正苦于以下问题:Python E.script方法的具体用法?Python E.script怎么用?Python E.script使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lxml.html.builder.E
的用法示例。
在下文中一共展示了E.script方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: jquery
# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import script [as 别名]
def jquery(url="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.js",
standalone=False):
if standalone:
path = ARTDOC / "js" / "jquery.js"
file = path.open("wb")
file.write(urllib.urlopen(url).read())
file.close()
return [HTML.script(src=str(path))]
else:
return [HTML.script(src=url)]
示例2: mathjax
# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import script [as 别名]
def mathjax(url="http://cdn.mathjax.org/mathjax/latest/MathJax.js",
zip_url="https://github.com/mathjax/MathJax/archive/master.zip",
config="TeX-AMS_HTML",
extra={"HTML-CSS": {"scale": 90, "availableFonts": ["TeX"], "preferredFont": "TeX"},
"TeX": {"equationNumbers": {"autoNumber": "AMS"}}},
standalone=False):
if standalone:
zip_file = tempfile.NamedTemporaryFile(suffix=".zip", delete=False)
zip_file.write(urllib.urlopen(zip_url).read())
zip_filename = zip_file.name
zip_file.close()
zipfile.ZipFile(zip_filename).extractall(str(ARTDOC))
os.remove(zip_filename)
url = str(ARTDOC / "MathJax-master" / "MathJax.js")
if config:
url = url + "?config=" + config
if extra is not None:
js = "MathJax.Hub.Config({0})".format(json.dumps(extra))
else:
js = ""
return [HTML.script(dict(src=url), js)]
示例3: _build_html_scripts
# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import script [as 别名]
def _build_html_scripts(self):
for url in self.scripts:
self.elements.body.append(E.script(src=url))
示例4: artdoc
# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import script [as 别名]
def artdoc():
return [
HTML.link(rel="stylesheet", href=".artdoc/css/style.css"),
HTML.script(src=".artdoc/js/main.js")
]
示例5: highlight
# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import script [as 别名]
def highlight(*args, **kwargs):
return [HTML.script(src=str(ARTDOC / "js" / "highlight.pack.js"))]
示例6: clipboard
# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import script [as 别名]
def clipboard(*args, **kwargs):
return [HTML.script(src=str(ARTDOC / "js" / "clipboard.js"))]
示例7: velocity
# 需要导入模块: from lxml.html.builder import E [as 别名]
# 或者: from lxml.html.builder.E import script [as 别名]
def velocity(*args, **kwargs):
return [HTML.script(src=str(ARTDOC / "js" / "velocity.js"))]