當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。