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


Python nodes.enumerated_list方法代码示例

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


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

示例1: visit_list_item

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import enumerated_list [as 别名]
def visit_list_item(self, node):
        children = []
        for child in node.children:
            if not isinstance(child, nodes.Invisible):
                children.append(child)
        if (children and isinstance(children[0], nodes.paragraph)
            and (isinstance(children[-1], nodes.bullet_list)
                 or isinstance(children[-1], nodes.enumerated_list))):
            children.pop()
        if len(children) <= 1:
            return
        else:
            raise nodes.NodeFound

    # def visit_bullet_list(self, node):
    #     pass

    # def visit_enumerated_list(self, node):
    #     pass

    # def visit_paragraph(self, node):
    #     raise nodes.SkipNode 
开发者ID:skarlekar,项目名称:faces,代码行数:24,代码来源:__init__.py

示例2: is_compactable

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import enumerated_list [as 别名]
def is_compactable(self, node):
        # print "is_compactable %s ?" % node.__class__,
        # explicite class arguments have precedence
        if 'compact' in node['classes']:
            return True
        if 'open' in node['classes']:
            return False
        # check config setting:
        if (isinstance(node, (nodes.field_list, nodes.definition_list))
            and not self.settings.compact_field_lists):
            # print "`compact-field-lists` is False"
            return False
        if (isinstance(node, (nodes.enumerated_list, nodes.bullet_list))
            and not self.settings.compact_lists):
            # print "`compact-lists` is False"
            return False
        # more special cases:
        if (self.topic_classes == ['contents']): # TODO: self.in_contents
            return True
        # check the list items:
        return self.check_simple_list(node) 
开发者ID:skarlekar,项目名称:faces,代码行数:23,代码来源:_html_base.py

示例3: visit_list_item

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import enumerated_list [as 别名]
def visit_list_item(self, node):
        # print "visiting list item", node.__class__
        children = [child for child in node.children
                    if not isinstance(child, nodes.Invisible)]
        # print "has %s visible children" % len(children)
        if (children and isinstance(children[0], nodes.paragraph)
            and (isinstance(children[-1], nodes.bullet_list) or
                 isinstance(children[-1], nodes.enumerated_list) or
                 isinstance(children[-1], nodes.field_list))):
            children.pop()
        # print "%s children remain" % len(children)
        if len(children) <= 1:
            return
        else:
            # print "found", child.__class__, "in", node.__class__
            raise nodes.NodeFound 
开发者ID:skarlekar,项目名称:faces,代码行数:18,代码来源:_html_base.py

示例4: visit_list_item

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import enumerated_list [as 别名]
def visit_list_item(self, node):
        children = []
        for child in node.children:
            if not isinstance(child, nodes.Invisible):
                children.append(child)
        if (children and isinstance(children[0], nodes.paragraph)
            and (isinstance(children[-1], nodes.bullet_list)
                 or isinstance(children[-1], nodes.enumerated_list))):
            children.pop()
        if len(children) <= 1:
            return
        else:
            raise nodes.NodeFound

    # def visit_bullet_list(self, node):
    #     pass

    # def visit_enumerated_list(self, node):
    #     pass 
开发者ID:aws-samples,项目名称:aws-builders-fair-projects,代码行数:21,代码来源:__init__.py

示例5: enumerator

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import enumerated_list [as 别名]
def enumerator(self, match, context, next_state):
        """Enumerated List Item"""
        format, sequence, text, ordinal = self.parse_enumerator(match)
        if not self.is_enumerated_list_item(ordinal, sequence, format):
            raise statemachine.TransitionCorrection('text')
        enumlist = nodes.enumerated_list()
        self.parent += enumlist
        if sequence == '#':
            enumlist['enumtype'] = 'arabic'
        else:
            enumlist['enumtype'] = sequence
        enumlist['prefix'] = self.enum.formatinfo[format].prefix
        enumlist['suffix'] = self.enum.formatinfo[format].suffix
        if ordinal != 1:
            enumlist['start'] = ordinal
            msg = self.reporter.info(
                'Enumerated list start value not ordinal-1: "%s" (ordinal %s)'
                % (text, ordinal))
            self.parent += msg
        listitem, blank_finish = self.list_item(match.end())
        enumlist += listitem
        offset = self.state_machine.line_offset + 1   # next line
        newline_offset, blank_finish = self.nested_list_parse(
              self.state_machine.input_lines[offset:],
              input_offset=self.state_machine.abs_line_offset() + 1,
              node=enumlist, initial_state='EnumeratedList',
              blank_finish=blank_finish,
              extra_settings={'lastordinal': ordinal,
                              'format': format,
                              'auto': sequence == '#'})
        self.goto_line(newline_offset)
        if not blank_finish:
            self.parent += self.unindent_warning('Enumerated list')
        return [], next_state, [] 
开发者ID:skarlekar,项目名称:faces,代码行数:36,代码来源:states.py

示例6: run

# 需要导入模块: from docutils import nodes [as 别名]
# 或者: from docutils.nodes import enumerated_list [as 别名]
def run(self):
        ad = super(NoteDirective, self).run()
        if (isinstance(ad[0][0], nodes.enumerated_list)
                and sum(1 for _ in ad[0][0].traverse(nodes.list_item)) > 1
                or isinstance(ad[0][0], nodes.footnote)
                and sum(1 for _ in ad[0].traverse(nodes.footnote)) > 1):
            ad[0].plural = True
        return ad 
开发者ID:georgia-tech-db,项目名称:eva,代码行数:10,代码来源:__init__.py


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