Python docutils.nodes.description() Examples
The following are 30
code examples of docutils.nodes.description().
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: states.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
def option_list_item(self, match): offset = self.state_machine.abs_line_offset() options = self.parse_option_marker(match) indented, indent, line_offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end()) if not indented: # not an option list item self.goto_line(offset) raise statemachine.TransitionCorrection('text') option_group = nodes.option_group('', *options) description = nodes.description('\n'.join(indented)) option_list_item = nodes.option_list_item('', option_group, description) if indented: self.nested_parse(indented, input_offset=line_offset, node=description) return option_list_item, blank_finish
Example #2
Source File: ext.py From safekit with MIT License | 6 votes |
def print_opt_list(data, nested_content): definitions = map_nested_definitions(nested_content) items = [] if 'options' in data: for opt in data['options']: names = [] my_def = [nodes.paragraph(text=opt['help'])] if opt['help'] else [] for name in opt['name']: option_declaration = [nodes.option_string(text=name)] if opt['default'] is not None \ and opt['default'] != '==SUPPRESS==': option_declaration += nodes.option_argument( '', text='=' + str(opt['default'])) names.append(nodes.option('', *option_declaration)) my_def = apply_definition(definitions, my_def, name) if len(my_def) == 0: my_def.append(nodes.paragraph(text='Undocumented')) if 'choices' in opt: my_def.append(nodes.paragraph( text=('Possible choices: %s' % ', '.join([str(c) for c in opt['choices']])))) items.append( nodes.option_list_item( '', nodes.option_group('', *names), nodes.description('', *my_def))) return nodes.option_list('', *items) if items else None
Example #3
Source File: ext.py From safekit with MIT License | 6 votes |
def _format_positional_arguments(self, parser_info): assert 'args' in parser_info items = [] for arg in parser_info['args']: arg_items = [] if arg['help']: arg_items.append(nodes.paragraph(text=arg['help'])) else: arg_items.append(nodes.paragraph(text='Undocumented')) if 'choices' in arg: arg_items.append( nodes.paragraph( text='Possible choices: ' + ', '.join(arg['choices']))) items.append( nodes.option_list_item( '', nodes.option_group( '', nodes.option( '', nodes.option_string(text=arg['metavar']) ) ), nodes.description('', *arg_items))) return nodes.option_list('', *items)
Example #4
Source File: states.py From bash-lambda-layer with MIT License | 6 votes |
def option_list_item(self, match): offset = self.state_machine.abs_line_offset() options = self.parse_option_marker(match) indented, indent, line_offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end()) if not indented: # not an option list item self.goto_line(offset) raise statemachine.TransitionCorrection('text') option_group = nodes.option_group('', *options) description = nodes.description('\n'.join(indented)) option_list_item = nodes.option_list_item('', option_group, description) if indented: self.nested_parse(indented, input_offset=line_offset, node=description) return option_list_item, blank_finish
Example #5
Source File: __init__.py From bash-lambda-layer with MIT License | 6 votes |
def visit_paragraph(self, node): # insert blank line, unless # * the paragraph is first in a list item or compound, # * follows a non-paragraph node in a compound, # * is in a table with auto-width columns index = node.parent.index(node) if index == 0 and isinstance(node.parent, (nodes.list_item, nodes.description, nodes.compound)): pass elif (index > 0 and isinstance(node.parent, nodes.compound) and not isinstance(node.parent[index - 1], nodes.paragraph) and not isinstance(node.parent[index - 1], nodes.compound)): pass elif self.active_table.colwidths_auto: if index == 1: # second paragraph self.warn('LaTeX merges paragraphs in tables ' 'with auto-sized columns!', base_node=node) if index > 0: self.out.append('\n') else: self.out.append('\n') if node.get('ids'): self.out += self.ids_to_labels(node) + ['\n'] if node['classes']: self.visit_inline(node)
Example #6
Source File: states.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 6 votes |
def option_list_item(self, match): offset = self.state_machine.abs_line_offset() options = self.parse_option_marker(match) indented, indent, line_offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end()) if not indented: # not an option list item self.goto_line(offset) raise statemachine.TransitionCorrection('text') option_group = nodes.option_group('', *options) description = nodes.description('\n'.join(indented)) option_list_item = nodes.option_list_item('', option_group, description) if indented: self.nested_parse(indented, input_offset=line_offset, node=description) return option_list_item, blank_finish
Example #7
Source File: __init__.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 6 votes |
def visit_paragraph(self, node): # insert blank line, unless # * the paragraph is first in a list item or compound, # * follows a non-paragraph node in a compound, # * is in a table with auto-width columns index = node.parent.index(node) if index == 0 and isinstance(node.parent, (nodes.list_item, nodes.description, nodes.compound)): pass elif (index > 0 and isinstance(node.parent, nodes.compound) and not isinstance(node.parent[index - 1], nodes.paragraph) and not isinstance(node.parent[index - 1], nodes.compound)): pass elif self.active_table.colwidths_auto: if index == 1: # second paragraph self.warn('LaTeX merges paragraphs in tables ' 'with auto-sized columns!', base_node=node) if index > 0: self.out.append('\n') else: self.out.append('\n') if node.get('ids'): self.out += self.ids_to_labels(node) + ['\n'] if node['classes']: self.visit_inline(node)
Example #8
Source File: states.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
def option_list_item(self, match): offset = self.state_machine.abs_line_offset() options = self.parse_option_marker(match) indented, indent, line_offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end()) if not indented: # not an option list item self.goto_line(offset) raise statemachine.TransitionCorrection('text') option_group = nodes.option_group('', *options) description = nodes.description('\n'.join(indented)) option_list_item = nodes.option_list_item('', option_group, description) if indented: self.nested_parse(indented, input_offset=line_offset, node=description) return option_list_item, blank_finish
Example #9
Source File: __init__.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
def visit_paragraph(self, node): # insert blank line, unless # * the paragraph is first in a list item or compound, # * follows a non-paragraph node in a compound, # * is in a table with auto-width columns index = node.parent.index(node) if index == 0 and isinstance(node.parent, (nodes.list_item, nodes.description, nodes.compound)): pass elif (index > 0 and isinstance(node.parent, nodes.compound) and not isinstance(node.parent[index - 1], nodes.paragraph) and not isinstance(node.parent[index - 1], nodes.compound)): pass elif self.active_table.colwidths_auto: if index == 1: # second paragraph self.warn('LaTeX merges paragraphs in tables ' 'with auto-sized columns!', base_node=node) if index > 0: self.out.append('\n') else: self.out.append('\n') if node.get('ids'): self.out += self.ids_to_labels(node) + ['\n'] if node['classes']: self.visit_inline(node)
Example #10
Source File: ext.py From rucio with Apache License 2.0 | 6 votes |
def _format_positional_arguments(self, parser_info): assert 'args' in parser_info items = [] for arg in parser_info['args']: arg_items = [] if arg['help']: arg_items.append(nodes.paragraph(text=arg['help'])) elif 'choices' not in arg: arg_items.append(nodes.paragraph(text='Undocumented')) if 'choices' in arg: arg_items.append( nodes.paragraph( text='Possible choices: ' + ', '.join(arg['choices']))) items.append( nodes.option_list_item( '', nodes.option_group( '', nodes.option( '', nodes.option_string(text=arg['metavar']) ) ), nodes.description('', *arg_items))) return nodes.option_list('', *items)
Example #11
Source File: __init__.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
def visit_paragraph(self, node): # insert blank line, unless # * the paragraph is first in a list item or compound, # * follows a non-paragraph node in a compound, # * is in a table with auto-width columns index = node.parent.index(node) if index == 0 and isinstance(node.parent, (nodes.list_item, nodes.description, nodes.compound)): pass elif (index > 0 and isinstance(node.parent, nodes.compound) and not isinstance(node.parent[index - 1], nodes.paragraph) and not isinstance(node.parent[index - 1], nodes.compound)): pass elif self.active_table.colwidths_auto: if index == 1: # second paragraph self.warn('LaTeX merges paragraphs in tables ' 'with auto-sized columns!', base_node=node) if index > 0: self.out.append('\n') else: self.out.append('\n') if node.get('ids'): self.out += self.ids_to_labels(node) + ['\n'] if node['classes']: self.visit_inline(node)
Example #12
Source File: states.py From blackmamba with MIT License | 6 votes |
def option_list_item(self, match): offset = self.state_machine.abs_line_offset() options = self.parse_option_marker(match) indented, indent, line_offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end()) if not indented: # not an option list item self.goto_line(offset) raise statemachine.TransitionCorrection('text') option_group = nodes.option_group('', *options) description = nodes.description('\n'.join(indented)) option_list_item = nodes.option_list_item('', option_group, description) if indented: self.nested_parse(indented, input_offset=line_offset, node=description) return option_list_item, blank_finish
Example #13
Source File: __init__.py From blackmamba with MIT License | 6 votes |
def visit_paragraph(self, node): # insert blank line, unless # * the paragraph is first in a list item or compound, # * follows a non-paragraph node in a compound, # * is in a table with auto-width columns index = node.parent.index(node) if index == 0 and isinstance(node.parent, (nodes.list_item, nodes.description, nodes.compound)): pass elif (index > 0 and isinstance(node.parent, nodes.compound) and not isinstance(node.parent[index - 1], nodes.paragraph) and not isinstance(node.parent[index - 1], nodes.compound)): pass elif self.active_table.colwidths_auto: if index == 1: # second paragraph self.warn('LaTeX merges paragraphs in tables ' 'with auto-sized columns!', base_node=node) if index > 0: self.out.append('\n') else: self.out.append('\n') if node.get('ids'): self.out += self.ids_to_labels(node) + ['\n'] if node['classes']: self.visit_inline(node)
Example #14
Source File: states.py From aws-extender with MIT License | 6 votes |
def option_list_item(self, match): offset = self.state_machine.abs_line_offset() options = self.parse_option_marker(match) indented, indent, line_offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end()) if not indented: # not an option list item self.goto_line(offset) raise statemachine.TransitionCorrection('text') option_group = nodes.option_group('', *options) description = nodes.description('\n'.join(indented)) option_list_item = nodes.option_list_item('', option_group, description) if indented: self.nested_parse(indented, input_offset=line_offset, node=description) return option_list_item, blank_finish
Example #15
Source File: __init__.py From aws-extender with MIT License | 6 votes |
def visit_paragraph(self, node): # insert blank line, unless # * the paragraph is first in a list item or compound, # * follows a non-paragraph node in a compound, # * is in a table with auto-width columns index = node.parent.index(node) if index == 0 and isinstance(node.parent, (nodes.list_item, nodes.description, nodes.compound)): pass elif (index > 0 and isinstance(node.parent, nodes.compound) and not isinstance(node.parent[index - 1], nodes.paragraph) and not isinstance(node.parent[index - 1], nodes.compound)): pass elif self.active_table.colwidths_auto: if index == 1: # second paragraph self.warn('LaTeX merges paragraphs in tables ' 'with auto-sized columns!', base_node=node) if index > 0: self.out.append('\n') else: self.out.append('\n') if node.get('ids'): self.out += self.ids_to_labels(node) + ['\n'] if node['classes']: self.visit_inline(node)
Example #16
Source File: states.py From aws-builders-fair-projects with Apache License 2.0 | 6 votes |
def option_list_item(self, match): offset = self.state_machine.abs_line_offset() options = self.parse_option_marker(match) indented, indent, line_offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end()) if not indented: # not an option list item self.goto_line(offset) raise statemachine.TransitionCorrection('text') option_group = nodes.option_group('', *options) description = nodes.description('\n'.join(indented)) option_list_item = nodes.option_list_item('', option_group, description) if indented: self.nested_parse(indented, input_offset=line_offset, node=description) return option_list_item, blank_finish
Example #17
Source File: __init__.py From aws-builders-fair-projects with Apache License 2.0 | 6 votes |
def visit_paragraph(self, node): # insert blank line, unless # * the paragraph is first in a list item or compound, # * follows a non-paragraph node in a compound, # * is in a table with auto-width columns index = node.parent.index(node) if index == 0 and isinstance(node.parent, (nodes.list_item, nodes.description, nodes.compound)): pass elif (index > 0 and isinstance(node.parent, nodes.compound) and not isinstance(node.parent[index - 1], nodes.paragraph) and not isinstance(node.parent[index - 1], nodes.compound)): pass elif self.active_table.colwidths_auto: if index == 1: # second paragraph self.warn('LaTeX merges paragraphs in tables ' 'with auto-sized columns!', base_node=node) if index > 0: self.out.append('\n') else: self.out.append('\n') if node.get('ids'): self.out += self.ids_to_labels(node) + ['\n'] if node['classes']: self.visit_inline(node)
Example #18
Source File: ext.py From safekit with MIT License | 6 votes |
def print_arg_list(data, nested_content): definitions = map_nested_definitions(nested_content) items = [] if 'args' in data: for arg in data['args']: my_def = [nodes.paragraph(text=arg['help'])] if arg['help'] else [] name = arg['name'] my_def = apply_definition(definitions, my_def, name) if len(my_def) == 0: my_def.append(nodes.paragraph(text='Undocumented')) if 'choices' in arg: my_def.append(nodes.paragraph( text=('Possible choices: %s' % ', '.join([str(c) for c in arg['choices']])))) items.append( nodes.option_list_item( '', nodes.option_group('', nodes.option_string(text=name)), nodes.description('', *my_def))) return nodes.option_list('', *items) if items else None
Example #19
Source File: states.py From faces with GNU General Public License v2.0 | 6 votes |
def option_list_item(self, match): offset = self.state_machine.abs_line_offset() options = self.parse_option_marker(match) indented, indent, line_offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end()) if not indented: # not an option list item self.goto_line(offset) raise statemachine.TransitionCorrection('text') option_group = nodes.option_group('', *options) description = nodes.description('\n'.join(indented)) option_list_item = nodes.option_list_item('', option_group, description) if indented: self.nested_parse(indented, input_offset=line_offset, node=description) return option_list_item, blank_finish
Example #20
Source File: states.py From deepWordBug with Apache License 2.0 | 6 votes |
def option_list_item(self, match): offset = self.state_machine.abs_line_offset() options = self.parse_option_marker(match) indented, indent, line_offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end()) if not indented: # not an option list item self.goto_line(offset) raise statemachine.TransitionCorrection('text') option_group = nodes.option_group('', *options) description = nodes.description('\n'.join(indented)) option_list_item = nodes.option_list_item('', option_group, description) if indented: self.nested_parse(indented, input_offset=line_offset, node=description) return option_list_item, blank_finish
Example #21
Source File: __init__.py From faces with GNU General Public License v2.0 | 6 votes |
def visit_paragraph(self, node): # insert blank line, unless # * the paragraph is first in a list item, # * follows a non-paragraph node in a compound, # * is in a table with auto-width columns index = node.parent.index(node) if (index == 0 and (isinstance(node.parent, nodes.list_item) or isinstance(node.parent, nodes.description))): pass elif (index > 0 and isinstance(node.parent, nodes.compound) and not isinstance(node.parent[index - 1], nodes.paragraph) and not isinstance(node.parent[index - 1], nodes.compound)): pass elif self.active_table.colwidths_auto: if index == 1: # second paragraph self.warn('LaTeX merges paragraphs in tables ' 'with auto-sized columns!', base_node=node) if index > 0: self.out.append('\n') else: self.out.append('\n') if node.get('ids'): self.out += self.ids_to_labels(node) + ['\n'] if node['classes']: self.visit_inline(node)
Example #22
Source File: __init__.py From deepWordBug with Apache License 2.0 | 6 votes |
def visit_paragraph(self, node): # insert blank line, unless # * the paragraph is first in a list item or compound, # * follows a non-paragraph node in a compound, # * is in a table with auto-width columns index = node.parent.index(node) if index == 0 and isinstance(node.parent, (nodes.list_item, nodes.description, nodes.compound)): pass elif (index > 0 and isinstance(node.parent, nodes.compound) and not isinstance(node.parent[index - 1], nodes.paragraph) and not isinstance(node.parent[index - 1], nodes.compound)): pass elif self.active_table.colwidths_auto: if index == 1: # second paragraph self.warn('LaTeX merges paragraphs in tables ' 'with auto-sized columns!', base_node=node) if index > 0: self.out.append('\n') else: self.out.append('\n') if node.get('ids'): self.out += self.ids_to_labels(node) + ['\n'] if node['classes']: self.visit_inline(node)
Example #23
Source File: ext.py From safekit with MIT License | 6 votes |
def print_opt_list(data, nested_content): definitions = map_nested_definitions(nested_content) items = [] if 'options' in data: for opt in data['options']: names = [] my_def = [nodes.paragraph(text=opt['help'])] if opt['help'] else [] for name in opt['name']: option_declaration = [nodes.option_string(text=name)] if opt['default'] is not None \ and opt['default'] != '==SUPPRESS==': option_declaration += nodes.option_argument( '', text='=' + str(opt['default'])) names.append(nodes.option('', *option_declaration)) my_def = apply_definition(definitions, my_def, name) if len(my_def) == 0: my_def.append(nodes.paragraph(text='Undocumented')) if 'choices' in opt: my_def.append(nodes.paragraph( text=('Possible choices: %s' % ', '.join([str(c) for c in opt['choices']])))) items.append( nodes.option_list_item( '', nodes.option_group('', *names), nodes.description('', *my_def))) return nodes.option_list('', *items) if items else None
Example #24
Source File: states.py From faces with GNU General Public License v2.0 | 6 votes |
def option_list_item(self, match): offset = self.state_machine.abs_line_offset() options = self.parse_option_marker(match) indented, indent, line_offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end()) if not indented: # not an option list item self.goto_line(offset) raise statemachine.TransitionCorrection('text') option_group = nodes.option_group('', *options) description = nodes.description('\n'.join(indented)) option_list_item = nodes.option_list_item('', option_group, description) if indented: self.nested_parse(indented, input_offset=line_offset, node=description) return option_list_item, blank_finish
Example #25
Source File: ext.py From safekit with MIT License | 6 votes |
def _format_positional_arguments(self, parser_info): assert 'args' in parser_info items = [] for arg in parser_info['args']: arg_items = [] if arg['help']: arg_items.append(nodes.paragraph(text=arg['help'])) else: arg_items.append(nodes.paragraph(text='Undocumented')) if 'choices' in arg: arg_items.append( nodes.paragraph( text='Possible choices: ' + ', '.join(arg['choices']))) items.append( nodes.option_list_item( '', nodes.option_group( '', nodes.option( '', nodes.option_string(text=arg['metavar']) ) ), nodes.description('', *arg_items))) return nodes.option_list('', *items)
Example #26
Source File: ext.py From safekit with MIT License | 6 votes |
def print_arg_list(data, nested_content): definitions = map_nested_definitions(nested_content) items = [] if 'args' in data: for arg in data['args']: my_def = [nodes.paragraph(text=arg['help'])] if arg['help'] else [] name = arg['name'] my_def = apply_definition(definitions, my_def, name) if len(my_def) == 0: my_def.append(nodes.paragraph(text='Undocumented')) if 'choices' in arg: my_def.append(nodes.paragraph( text=('Possible choices: %s' % ', '.join([str(c) for c in arg['choices']])))) items.append( nodes.option_list_item( '', nodes.option_group('', nodes.option_string(text=name)), nodes.description('', *my_def))) return nodes.option_list('', *items) if items else None
Example #27
Source File: __init__.py From aws-extender with MIT License | 5 votes |
def depart_definition_list(self, node): self.out.append( '\\end{description}\n' ) self.duclass_close(node)
Example #28
Source File: ext.py From rucio with Apache License 2.0 | 5 votes |
def _format_optional_arguments(self, parser_info): assert 'options' in parser_info items = [] for opt in parser_info['options']: names = [] opt_items = [] for name in opt['name']: option_declaration = [nodes.option_string(text=name)] if opt['default'] is not None \ and opt['default'] not in ['"==SUPPRESS=="', '==SUPPRESS==']: option_declaration += nodes.option_argument( '', text='=' + str(opt['default'])) names.append(nodes.option('', *option_declaration)) if opt['help']: opt_items.append(nodes.paragraph(text=opt['help'])) elif 'choices' not in opt: opt_items.append(nodes.paragraph(text='Undocumented')) if 'choices' in opt: opt_items.append( nodes.paragraph( text='Possible choices: ' + ', '.join(opt['choices']))) items.append( nodes.option_list_item( '', nodes.option_group('', *names), nodes.description('', *opt_items))) return nodes.option_list('', *items)
Example #29
Source File: ext.py From safekit with MIT License | 5 votes |
def _format_optional_arguments(self, parser_info): assert 'options' in parser_info items = [] for opt in parser_info['options']: names = [] opt_items = [] for name in opt['name']: option_declaration = [nodes.option_string(text=name)] if opt['default'] is not None \ and opt['default'] != '==SUPPRESS==': option_declaration += nodes.option_argument( '', text='=' + str(opt['default'])) names.append(nodes.option('', *option_declaration)) if opt['help']: opt_items.append(nodes.paragraph(text=opt['help'])) else: opt_items.append(nodes.paragraph(text='Undocumented')) if 'choices' in opt: opt_items.append( nodes.paragraph( text='Possible choices: ' + ', '.join(opt['choices']))) items.append( nodes.option_list_item( '', nodes.option_group('', *names), nodes.description('', *opt_items))) return nodes.option_list('', *items)
Example #30
Source File: __init__.py From aws-extender with MIT License | 5 votes |
def visit_definition_list(self, node): self.duclass_open(node) self.out.append( '\\begin{description}\n' )