本文整理汇总了Python中recommonmark.parser.CommonMarkParser方法的典型用法代码示例。如果您正苦于以下问题:Python parser.CommonMarkParser方法的具体用法?Python parser.CommonMarkParser怎么用?Python parser.CommonMarkParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类recommonmark.parser
的用法示例。
在下文中一共展示了parser.CommonMarkParser方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: from recommonmark import parser [as 别名]
# 或者: from recommonmark.parser import CommonMarkParser [as 别名]
def setup(app):
app.add_source_suffix('.md', 'markdown')
app.add_source_parser(CommonMarkParser)
示例2: build_row
# 需要导入模块: from recommonmark import parser [as 别名]
# 或者: from recommonmark.parser import CommonMarkParser [as 别名]
def build_row(item):
"""Return nodes.row with property description"""
prop, propschema, required = item
row = nodes.row()
# Property
row += nodes.entry("", nodes.paragraph(text=prop), classes=["vl-prop"])
# Type
str_type = type_description(propschema)
par_type = nodes.paragraph()
is_text = True
for part in reClassDef.split(str_type):
if part:
if is_text:
add_text(par_type, part)
else:
add_class_def(par_type, part)
is_text = not is_text
# row += nodes.entry('')
row += nodes.entry("", par_type) # , classes=["vl-type-def"]
# Description
md_parser = CommonMarkParser()
# str_descr = "***Required.*** " if required else ""
str_descr = ""
str_descr += propschema.get("description", " ")
doc_descr = utils.new_document("schema_description")
md_parser.parse(str_descr, doc_descr)
# row += nodes.entry('', *doc_descr.children, classes="vl-decsr")
row += nodes.entry("", *doc_descr.children, classes=["vl-decsr"])
return row
示例3: setup
# 需要导入模块: from recommonmark import parser [as 别名]
# 或者: from recommonmark.parser import CommonMarkParser [as 别名]
def setup(app):
"""Setup the hooks for recommonmark."""
app.add_config_value('recommonmark_config', {
# 'url_resolver': lambda url: github_doc_root + url,
'auto_toc_tree_section': 'Contents',
'enable_eval_rst': True,
}, True)
app.add_source_parser(CommonMarkParser)
app.add_transform(AutoStructify)
示例4: cm2html
# 需要导入模块: from recommonmark import parser [as 别名]
# 或者: from recommonmark.parser import CommonMarkParser [as 别名]
def cm2html():
description = ('Generate html document from markdown sources. ' + default_description)
publish_cmdline(writer_name='html',
parser=CommonMarkParser(),
description=description)
示例5: cm2man
# 需要导入模块: from recommonmark import parser [as 别名]
# 或者: from recommonmark.parser import CommonMarkParser [as 别名]
def cm2man():
description = ('Generate a manpage from markdown sources. ' + default_description)
publish_cmdline(writer_name='manpage',
parser=CommonMarkParser(),
description=description)
示例6: cm2xml
# 需要导入模块: from recommonmark import parser [as 别名]
# 或者: from recommonmark.parser import CommonMarkParser [as 别名]
def cm2xml():
description = ('Generate XML document from markdown sources. ' + default_description)
publish_cmdline(writer_name='xml',
parser=CommonMarkParser(),
description=description)
示例7: cm2pseudoxml
# 需要导入模块: from recommonmark import parser [as 别名]
# 或者: from recommonmark.parser import CommonMarkParser [as 别名]
def cm2pseudoxml():
description = ('Generate pseudo-XML document from markdown sources. ' + default_description)
publish_cmdline(writer_name='pseudoxml',
parser=CommonMarkParser(),
description=description)
示例8: cm2latex
# 需要导入模块: from recommonmark import parser [as 别名]
# 或者: from recommonmark.parser import CommonMarkParser [as 别名]
def cm2latex():
description = ('Generate latex document from markdown sources. ' + default_description)
publish_cmdline(writer_name='latex',
parser=CommonMarkParser(),
description=description)
示例9: assertParses
# 需要导入模块: from recommonmark import parser [as 别名]
# 或者: from recommonmark.parser import CommonMarkParser [as 别名]
def assertParses(self, source, expected, alt=False): # noqa
parser = CommonMarkParser()
parser.parse(dedent(source), new_document('<string>'))
self.maxDiff = None
self.assertMultiLineEqual(
dedent(expected).lstrip(),
dedent(parser.document.asdom().toprettyxml(indent=' ')),
)