当前位置: 首页>>代码示例>>Python>>正文


Python html4css1.Writer方法代码示例

本文整理汇总了Python中docutils.writers.html4css1.Writer方法的典型用法代码示例。如果您正苦于以下问题:Python html4css1.Writer方法的具体用法?Python html4css1.Writer怎么用?Python html4css1.Writer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在docutils.writers.html4css1的用法示例。


在下文中一共展示了html4css1.Writer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: render

# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import Writer [as 别名]
def render(raw, stream=None, **kwargs):
    if stream is None:
        # Use a io.StringIO as the warning stream to prevent warnings from
        # being printed to sys.stderr.
        stream = io.StringIO()

    settings = SETTINGS.copy()
    settings["warning_stream"] = stream

    writer = Writer()
    writer.translator_class = ReadMeHTMLTranslator

    try:
        parts = publish_parts(raw, writer=writer, settings_overrides=settings)
    except SystemMessage:
        rendered = None
    else:
        rendered = parts.get("docinfo", "") + parts.get("fragment", "")

    if rendered:
        return clean(rendered)
    else:
        return None 
开发者ID:pypa,项目名称:readme_renderer,代码行数:25,代码来源:rst.py

示例2: render

# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import Writer [as 别名]
def render(raw, stream=None):
    if stream is None:
        # Use a io.StringIO as the warning stream to prevent warnings from
        # being printed to sys.stderr.
        stream = io.StringIO()

    settings = SETTINGS.copy()
    settings["warning_stream"] = stream

    writer = Writer()
    writer.translator_class = ReadMeHTMLTranslator

    try:
        parts = publish_parts(raw, writer=writer, settings_overrides=settings)
    except SystemMessage:
        rendered = None
    else:
        rendered = parts.get("fragment")

    if rendered:
        return clean(rendered)
    else:
        return None 
开发者ID:holzschu,项目名称:Carnets,代码行数:25,代码来源:rst.py

示例3: __init__

# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import Writer [as 别名]
def __init__(self):
        html4css1.Writer.__init__(self)
        self.translator_class = S5HTMLTranslator 
开发者ID:skarlekar,项目名称:faces,代码行数:5,代码来源:__init__.py

示例4: __init__

# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import Writer [as 别名]
def __init__(self):
        html4css1.Writer.__init__(self)
        self.translator_class = HTMLTranslator 
开发者ID:skarlekar,项目名称:faces,代码行数:5,代码来源:__init__.py

示例5: interpolation_dict

# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import Writer [as 别名]
def interpolation_dict(self):
        subs = html4css1.Writer.interpolation_dict(self)
        settings = self.document.settings
        pyhome = settings.python_home
        subs['pyhome'] = pyhome
        subs['pephome'] = settings.pep_home
        if pyhome == '..':
            subs['pepindex'] = '.'
        else:
            subs['pepindex'] = pyhome + '/dev/peps'
        index = self.document.first_child_matching_class(nodes.field_list)
        header = self.document[index]
        self.pepnum = header[0][1].astext()
        subs['pep'] = self.pepnum
        if settings.no_random:
            subs['banner'] = 0
        else:
            import random
            subs['banner'] = random.randrange(64)
        try:
            subs['pepnum'] = '%04i' % int(self.pepnum)
        except ValueError:
            subs['pepnum'] = self.pepnum
        self.title = header[1][1].astext()
        subs['title'] = self.title
        subs['body'] = ''.join(
            self.body_pre_docinfo + self.docinfo + self.body)
        return subs 
开发者ID:skarlekar,项目名称:faces,代码行数:30,代码来源:__init__.py

示例6: assemble_parts

# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import Writer [as 别名]
def assemble_parts(self):
        html4css1.Writer.assemble_parts(self)
        self.parts['title'] = [self.title]
        self.parts['pepnum'] = self.pepnum 
开发者ID:skarlekar,项目名称:faces,代码行数:6,代码来源:__init__.py

示例7: __init__

# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import Writer [as 别名]
def __init__(self):
        html4css1.Writer.__init__(self)
        self.translator_class = self._CustomHTMLTranslator 
开发者ID:UCL-INGI,项目名称:INGInious,代码行数:5,代码来源:parsable_text.py

示例8: _render_html

# 需要导入模块: from docutils.writers import html4css1 [as 别名]
# 或者: from docutils.writers.html4css1 import Writer [as 别名]
def _render_html(source):
        return core.publish_parts(
            source=source,
            writer=Writer(),
            writer_name='html',
            settings_overrides={'no_system_messages': True}
        ) 
开发者ID:openstack,项目名称:tripleo-validations,代码行数:9,代码来源:ansible-autodoc.py


注:本文中的docutils.writers.html4css1.Writer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。