本文整理匯總了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]