Python docutils.nodes.enumerated_list() Examples
The following are 30
code examples of docutils.nodes.enumerated_list().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
docutils.nodes
, or try the search function
.
Example #1
Source File: __init__.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
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
Example #2
Source File: _html_base.py From aws-builders-fair-projects with Apache License 2.0 | 6 votes |
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
Example #3
Source File: _html_base.py From aws-builders-fair-projects with Apache License 2.0 | 6 votes |
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)
Example #4
Source File: __init__.py From aws-builders-fair-projects with Apache License 2.0 | 6 votes |
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
Example #5
Source File: _html_base.py From aws-extender with MIT License | 6 votes |
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
Example #6
Source File: _html_base.py From aws-extender with MIT License | 6 votes |
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)
Example #7
Source File: __init__.py From aws-extender with MIT License | 6 votes |
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
Example #8
Source File: _html_base.py From blackmamba with MIT License | 6 votes |
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
Example #9
Source File: _html_base.py From blackmamba with MIT License | 6 votes |
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)
Example #10
Source File: __init__.py From blackmamba with MIT License | 6 votes |
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
Example #11
Source File: _html_base.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
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
Example #12
Source File: _html_base.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
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)
Example #13
Source File: _html_base.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
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
Example #14
Source File: _html_base.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
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)
Example #15
Source File: _html_base.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 6 votes |
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
Example #16
Source File: _html_base.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 6 votes |
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)
Example #17
Source File: _html_base.py From deepWordBug with Apache License 2.0 | 6 votes |
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)
Example #18
Source File: __init__.py From faces with GNU General Public License v2.0 | 6 votes |
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
Example #19
Source File: _html_base.py From faces with GNU General Public License v2.0 | 6 votes |
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)
Example #20
Source File: _html_base.py From faces with GNU General Public License v2.0 | 6 votes |
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
Example #21
Source File: __init__.py From deepWordBug with Apache License 2.0 | 6 votes |
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
Example #22
Source File: __init__.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 6 votes |
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
Example #23
Source File: _html_base.py From deepWordBug with Apache License 2.0 | 6 votes |
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
Example #24
Source File: __init__.py From bash-lambda-layer with MIT License | 6 votes |
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
Example #25
Source File: _html_base.py From bash-lambda-layer with MIT License | 6 votes |
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)
Example #26
Source File: _html_base.py From bash-lambda-layer with MIT License | 6 votes |
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
Example #27
Source File: states.py From bash-lambda-layer with MIT License | 5 votes |
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, []
Example #28
Source File: states.py From blackmamba with MIT License | 5 votes |
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, []
Example #29
Source File: states.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 5 votes |
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, []
Example #30
Source File: states.py From aws-extender with MIT License | 5 votes |
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, []