本文整理汇总了Python中docutils.readers.standalone.Reader方法的典型用法代码示例。如果您正苦于以下问题:Python standalone.Reader方法的具体用法?Python standalone.Reader怎么用?Python standalone.Reader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类docutils.readers.standalone
的用法示例。
在下文中一共展示了standalone.Reader方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: publish_secondary_doctree
# 需要导入模块: from docutils.readers import standalone [as 别名]
# 或者: from docutils.readers.standalone import Reader [as 别名]
def publish_secondary_doctree(text, main_tree, source_path):
# This is a hack so the text substitutions defined
# in the document are available when we process the cover
# page. See Issue 322
dt = main_tree
# Add substitutions from the main doctree
class addSubsts(Transform):
default_priority = 219
def apply(self):
self.document.substitution_defs.update(dt.substitution_defs)
self.document.substitution_names.update(dt.substitution_names)
# Use an own reader to modify transformations done.
class Reader(standalone.Reader):
def get_transforms(self):
default = standalone.Reader.get_transforms(self)
return default + [
addSubsts,
]
# End of Issue 322 hack
return docutils.core.publish_doctree(text, reader=Reader(), source_path=source_path)
示例2: get_transforms
# 需要导入模块: from docutils.readers import standalone [as 别名]
# 或者: from docutils.readers.standalone import Reader [as 别名]
def get_transforms(self):
transforms = standalone.Reader.get_transforms(self)
# We have PEP-specific frontmatter handling.
transforms.remove(frontmatter.DocTitle)
transforms.remove(frontmatter.SectionSubTitle)
transforms.remove(frontmatter.DocInfo)
transforms.extend([peps.Headers, peps.Contents, peps.TargetNotes])
return transforms
示例3: __init__
# 需要导入模块: from docutils.readers import standalone [as 别名]
# 或者: from docutils.readers.standalone import Reader [as 别名]
def __init__(self, parser=None, parser_name=None):
"""`parser` should be ``None``."""
if parser is None:
parser = rst.Parser(rfc2822=True, inliner=self.inliner_class())
standalone.Reader.__init__(self, parser, '')
示例4: get_transforms
# 需要导入模块: from docutils.readers import standalone [as 别名]
# 或者: from docutils.readers.standalone import Reader [as 别名]
def get_transforms(self):
default = standalone.Reader.get_transforms(self)
if self.settings.create_links:
return default
return [ i
for i in default
if i is not references.DanglingReferences ]
示例5: get_transforms
# 需要导入模块: from docutils.readers import standalone [as 别名]
# 或者: from docutils.readers.standalone import Reader [as 别名]
def get_transforms(self):
"""Get default transforms without DocInfo."""
transforms = standalone.Reader.get_transforms(self)
transforms.remove(frontmatter.DocInfo)
return transforms
示例6: get_transforms
# 需要导入模块: from docutils.readers import standalone [as 别名]
# 或者: from docutils.readers.standalone import Reader [as 别名]
def get_transforms(self):
default = standalone.Reader.get_transforms(self)
if self.settings.create_links:
return default
return [i for i in default
if i is not references.DanglingReferences]