本文整理匯總了Python中docutils.writers.Writer方法的典型用法代碼示例。如果您正苦於以下問題:Python writers.Writer方法的具體用法?Python writers.Writer怎麽用?Python writers.Writer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類docutils.writers
的用法示例。
在下文中一共展示了writers.Writer方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: assemble_my_parts
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def assemble_my_parts(self):
"""Assemble the `self.parts` dictionary. Extend in subclasses.
"""
writers.Writer.assemble_parts(self)
f = tempfile.NamedTemporaryFile()
zfile = zipfile.ZipFile(f, 'w', zipfile.ZIP_DEFLATED)
self.write_zip_str(zfile, 'mimetype', self.MIME_TYPE,
compress_type=zipfile.ZIP_STORED)
content = self.visitor.content_astext()
self.write_zip_str(zfile, 'content.xml', content)
s1 = self.create_manifest()
self.write_zip_str(zfile, 'META-INF/manifest.xml', s1)
s1 = self.create_meta()
self.write_zip_str(zfile, 'meta.xml', s1)
s1 = self.get_stylesheet()
self.write_zip_str(zfile, 'styles.xml', s1)
self.store_embedded_files(zfile)
self.copy_from_stylesheet(zfile)
zfile.close()
f.seek(0)
whole = f.read()
f.close()
self.parts['whole'] = whole
self.parts['encoding'] = self.document.settings.output_encoding
self.parts['version'] = docutils.__version__
示例2: __init__
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def __init__(self, builder=None):
writers.Writer.__init__(self)
self.builder = builder
示例3: __init__
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def __init__(self):
writers.Writer.__init__(self)
示例4: __init__
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def __init__(self):
writers.Writer.__init__(self)
self.translator_class = ODFTranslator
示例5: __init__
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def __init__(self):
writers.Writer.__init__(self)
self.translator_class = Translator
示例6: __init__
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def __init__(self):
writers.Writer.__init__(self)
self.translator_class = XMLTranslator
示例7: assemble_parts
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def assemble_parts(self):
writers.Writer.assemble_parts(self)
for part in self.visitor_attributes:
self.parts[part] = ''.join(getattr(self, part))
示例8: __init__
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def __init__(self):
writers.Writer.__init__(self)
self.translator_class = LaTeXTranslator
# Override parent method to add latex-specific transforms
示例9: get_transforms
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def get_transforms(self):
return writers.Writer.get_transforms(self) + [
# Convert specific admonitions to generic one
writer_aux.Admonitions,
# TODO: footnote collection transform
]
示例10: assemble_parts
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def assemble_parts(self):
"""Assemble the `self.parts` dictionary of output fragments."""
writers.Writer.assemble_parts(self)
for part in self.visitor_attributes:
lines = getattr(self, part)
if part in self.head_parts:
if lines:
lines.append('') # to get a trailing newline
self.parts[part] = '\n'.join(lines)
else:
# body contains inline elements, so join without newline
self.parts[part] = ''.join(lines)
示例11: __init__
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def __init__(self, builder):
writers.Writer.__init__(self)
self.builder = builder
示例12: get_transforms
# 需要導入模塊: from docutils import writers [as 別名]
# 或者: from docutils.writers import Writer [as 別名]
def get_transforms(self):
return writers.Writer.get_transforms(self) + [writer_aux.Admonitions]