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


Python nodes.comment方法代码示例

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


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

示例1: process_only_nodes

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import comment [as 别名]
def process_only_nodes(config, document, tags):
    # type: (nodes.Node, Tags) -> None
    """Filter ``only`` nodes which does not match *tags* or html (through config)"""
    ret_html_cell = config['jupyter_allow_html_only'] 
    for node in document.traverse(addnodes.only):
        try:
            ret = tags.eval_condition(node['expr'])  #check for jupyter only
            if ret_html_cell and node['expr'] == 'html':  #allow html only cells if option is specified
                ret = True
        except Exception as err:
            logger.warning(__('exception while evaluating only directive expression: %s'), err,
                           location=node)
            node.replace_self(node.children or nodes.comment())
        else:
            if ret:
                node.replace_self(node.children or nodes.comment())
            else:
                # A comment on the comment() nodes being inserted: replacing by [] would
                # result in a "Losing ids" exception if there is a target node before
                # the only node, so we make sure docutils can transfer the id to
                # something, even if it's just a comment and will lose the id anyway...
                node.replace_self(nodes.comment()) 
开发者ID:QuantEcon,项目名称:sphinxcontrib-jupyter,代码行数:24,代码来源:__init__.py

示例2: apply

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import comment [as 别名]
def apply(self):
        if self.document.settings.strip_comments:
            for node in self.document.traverse(nodes.comment):
                node.parent.remove(node) 
开发者ID:skarlekar,项目名称:faces,代码行数:6,代码来源:universal.py

示例3: comment

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import comment [as 别名]
def comment(self, match):
        if not match.string[match.end():].strip() \
              and self.state_machine.is_next_line_blank(): # an empty comment?
            return [nodes.comment()], 1 # "A tiny but practical wart."
        indented, indent, offset, blank_finish = \
              self.state_machine.get_first_known_indented(match.end())
        while indented and not indented[-1].strip():
            indented.trim_end()
        text = '\n'.join(indented)
        return [nodes.comment(text, text)], blank_finish 
开发者ID:skarlekar,项目名称:faces,代码行数:12,代码来源:states.py

示例4: explicit_construct

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import comment [as 别名]
def explicit_construct(self, match):
        """Determine which explicit construct this is, parse & return it."""
        errors = []
        for method, pattern in self.explicit.constructs:
            expmatch = pattern.match(match.string)
            if expmatch:
                try:
                    return method(self, expmatch)
                except MarkupError as error:
                    lineno = self.state_machine.abs_line_number()
                    message = ' '.join(error.args)
                    errors.append(self.reporter.warning(message, line=lineno))
                    break
        nodelist, blank_finish = self.comment(match)
        return nodelist + errors, blank_finish 
开发者ID:skarlekar,项目名称:faces,代码行数:17,代码来源:states.py

示例5: visit_comment

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import comment [as 别名]
def visit_comment(self, node: comment):
        """Begin ``comment`` node.

        comment node render as speaker note.
        """
        self.body.append('<aside class="notes">\n') 
开发者ID:attakei,项目名称:sphinx-revealjs,代码行数:8,代码来源:writers.py

示例6: depart_comment

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import comment [as 别名]
def depart_comment(self, node: comment):
        """End ``comment`` node.

        Close speaker note.
        """
        self.body.append("</aside>\n") 
开发者ID:attakei,项目名称:sphinx-revealjs,代码行数:8,代码来源:writers.py

示例7: authors_from_bullet_list

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import comment [as 别名]
def authors_from_bullet_list(self, field):
        authors = []
        for item in field[1][0]:
            if isinstance(item, nodes.comment):
                continue
            if len(item) != 1 or not isinstance(item[0], nodes.paragraph):
                raise TransformError
            authors.append(item[0].children)
        if not authors:
            raise TransformError
        return authors 
开发者ID:aws-samples,项目名称:aws-builders-fair-projects,代码行数:13,代码来源:frontmatter.py

示例8: authors_from_paragraphs

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import comment [as 别名]
def authors_from_paragraphs(self, field):
        for item in field[1]:
            if not isinstance(item, (nodes.paragraph, nodes.comment)):
                raise TransformError
        authors = [item.children for item in field[1]
                   if not isinstance(item, nodes.comment)]
        return authors 
开发者ID:aws-samples,项目名称:aws-builders-fair-projects,代码行数:9,代码来源:frontmatter.py


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