rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.body.append('\n@Display @Tbl rule { yes } {\n') | self.body.append('\n@Display @Tbl\n') if node.get('class', '') != 'norules': self.body.append(' rule { yes }\n') self.body.append('{\n') | def visit_table(self, node): self.body.append('\n@Display @Tbl rule { yes } {\n') #self.starttag(node, 'table', CLASS="table", border=None)) |
self.body.append('\n@LP @FullWidthRule\n') | self.body.append('\n@LP @FullWidthRule @PP\n') | def visit_transition(self, node): self.body.append('\n@LP @FullWidthRule\n') |
pub.set_writer(writer_name) | if not writer and writer_name: pub.set_writer(writer_name) | def publish_from_doctree(document, destination_path=None, writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=None): """ Set up & run a `Publisher` to render from an existing document tree data structure, for programmatic use with str... |
start = self.groups.initial.start - 1 backquote = self.groups.initial.backquote - 1 refend = self.groups.initial.refend - 1 fnend = self.groups.initial.fnend - 1 | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. | |
groups = match.groups() before, inlines, remaining, sysmessages = \ dispatch[groups[start] or groups[backquote] or groups[refend] or groups[fnend]](self, match, lineno) | groupdict = match.groupdict() method = dispatch[groupdict["start"] or groupdict["backquote"] or groupdict["refend"] or groupdict["fnend"]] before, inlines, remaining, sysmessages = method(self, match, lineno) | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
start_string_prefix = (r'(?:(?<=^)|(?<=[-/: \n%s]))' % re.escape(openers)) end_string_suffix = (r'(?:(?=$)|(?=[-/:.,;!? \n%s]))' % re.escape(closers)) | start_string_prefix = (r'((?<=^)|(?<=[-/: \n%s]))' % re.escape(openers)) end_string_suffix = (r'((?=$)|(?=[-/:.,;!? \n%s]))' % re.escape(closers)) | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
simplename = r'[a-zA-Z0-9](?:[-_.a-zA-Z0-9]*[a-zA-Z0-9])?' | simplename = r'[a-zA-Z0-9]([-_.a-zA-Z0-9]*[a-zA-Z0-9])?' | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
( | (?P<start> | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
( (%s) (__?) | (?P<whole> (?P<refname>%s) (?P<refend>__?) | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
( | (?P<footnotelabel> | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
(%s) | (?P<citationlabel>%s) | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
(\]_) | (?P<fnend>\]_) | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
((?::%s:)?) ( | (?P<role>(:%s:)?) (?P<backquote> | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
'%s(`(:%s:|__?)?)%s' % (non_whitespace_escape_before, simplename, end_string_suffix)), | '%s(`(?P<suffix>:%s:|__?)?)%s' % (non_whitespace_escape_before, simplename, end_string_suffix)), | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
( ( ( [a-zA-Z][a-zA-Z0-9.+-]* | (?P<whole> (?P<absolute> (?P<scheme> [a-zA-Z][a-zA-Z0-9.+-]* | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
(?: (?: (?://?)? | ( ( (//?)? | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
(?: | ( | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
( %s+(?:\.%s+)* | (?P<email> %s+(\.%s+)* | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
%s+(?:\.%s*)* | %s+(\.%s*)* | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. |
groups = Stuff(initial=Stuff(start=2, whole=3, refname=4, refend=5, footnotelabel=6, citationlabel=7, fnend=8, role=9, backquote=10), interpreted_or_phrase_ref=Stuff(suffix=2), uri=Stuff(whole=1, absolute=2, scheme=3, email=4)) | def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages. | |
matchstart = match.start(self.groups.initial.start) matchend = match.end(self.groups.initial.start) | matchstart = match.start('start') matchend = match.end('start') | def inline_obj(self, match, lineno, pattern, nodeclass, restore_backslashes=0): string = match.string matchstart = match.start(self.groups.initial.start) matchend = match.end(self.groups.initial.start) if self.quoted_start(match): return (string[:matchend], [], string[matchend:], [], '') endmatch = pattern.search(strin... |
rolegroup = self.groups.initial.role backquote = self.groups.initial.backquote | def interpreted_or_phrase_ref(self, match, lineno): pattern = self.patterns.interpreted_or_phrase_ref rolegroup = self.groups.initial.role backquote = self.groups.initial.backquote string = match.string matchstart = match.start(backquote) matchend = match.end(backquote) rolestart = match.start(rolegroup) role = match.g... | |
matchstart = match.start(backquote) matchend = match.end(backquote) rolestart = match.start(rolegroup) role = match.group(rolegroup) | matchstart = match.start('backquote') matchend = match.end('backquote') rolestart = match.start('role') role = match.group('role') | def interpreted_or_phrase_ref(self, match, lineno): pattern = self.patterns.interpreted_or_phrase_ref rolegroup = self.groups.initial.role backquote = self.groups.initial.backquote string = match.string matchstart = match.start(backquote) matchend = match.end(backquote) rolestart = match.start(rolegroup) role = match.g... |
suffix = self.groups.interpreted_or_phrase_ref.suffix if endmatch.group(suffix): | if endmatch.group('suffix'): | def interpreted(self, before, after, endmatch, role, position, lineno, escaped, rawsource, text): suffix = self.groups.interpreted_or_phrase_ref.suffix if endmatch.group(suffix): if role: msg = self.reporter.warning('Multiple roles in interpreted ' 'text at line %s.' % lineno) return (before + rawsource, [], after, [ms... |
role = endmatch.group(suffix)[1:-1] | role = endmatch.group('suffix')[1:-1] | def interpreted(self, before, after, endmatch, role, position, lineno, escaped, rawsource, text): suffix = self.groups.interpreted_or_phrase_ref.suffix if endmatch.group(suffix): if role: msg = self.reporter.warning('Multiple roles in interpreted ' 'text at line %s.' % lineno) return (before + rawsource, [], after, [ms... |
label = match.group(self.groups.initial.footnotelabel) | label = match.group('footnotelabel') | def footnote_reference(self, match, lineno): """ Handles `nodes.footnote_reference` and `nodes.citation_reference` elements. """ label = match.group(self.groups.initial.footnotelabel) refname = normalize_name(label) if match.group(self.groups.initial.citationlabel): refnode = nodes.citation_reference('[%s]_' % label, r... |
if match.group(self.groups.initial.citationlabel): | if match.group('citationlabel'): | def footnote_reference(self, match, lineno): """ Handles `nodes.footnote_reference` and `nodes.citation_reference` elements. """ label = match.group(self.groups.initial.footnotelabel) refname = normalize_name(label) if match.group(self.groups.initial.citationlabel): refnode = nodes.citation_reference('[%s]_' % label, r... |
matchstart = match.start(self.groups.initial.whole) matchend = match.end(self.groups.initial.whole) | matchstart = match.start('whole') matchend = match.end('whole') | def footnote_reference(self, match, lineno): """ Handles `nodes.footnote_reference` and `nodes.citation_reference` elements. """ label = match.group(self.groups.initial.footnotelabel) refname = normalize_name(label) if match.group(self.groups.initial.citationlabel): refnode = nodes.citation_reference('[%s]_' % label, r... |
referencename = match.group(self.groups.initial.refname) | referencename = match.group('refname') | def reference(self, match, lineno, anonymous=None): referencename = match.group(self.groups.initial.refname) refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group(self.groups.initial.refend), referencename) if anonymous: referencenode['anonymous'] = 1 self.document.note_an... |
referencenode = nodes.reference( referencename + match.group(self.groups.initial.refend), referencename) | referencenode = nodes.reference(referencename + match.group('refend'), referencename) | def reference(self, match, lineno, anonymous=None): referencename = match.group(self.groups.initial.refname) refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group(self.groups.initial.refend), referencename) if anonymous: referencenode['anonymous'] = 1 self.document.note_an... |
matchstart = match.start(self.groups.initial.whole) matchend = match.end(self.groups.initial.whole) | matchstart = match.start('whole') matchend = match.end('whole') | def reference(self, match, lineno, anonymous=None): referencename = match.group(self.groups.initial.refname) refname = normalize_name(referencename) referencenode = nodes.reference( referencename + match.group(self.groups.initial.refend), referencename) if anonymous: referencenode['anonymous'] = 1 self.document.note_an... |
scheme = self.groups.uri.scheme if not match.group(scheme) or urischemes.schemes.has_key( match.group(scheme).lower()): if match.group(self.groups.uri.email): | if not match.group('scheme') or urischemes.schemes.has_key( match.group('scheme').lower()): if match.group('email'): | def standalone_uri(self, match, lineno): scheme = self.groups.uri.scheme if not match.group(scheme) or urischemes.schemes.has_key( match.group(scheme).lower()): if match.group(self.groups.uri.email): addscheme = 'mailto:' else: addscheme = '' text = match.group(self.groups.uri.whole) unescaped = unescape(text, 0) retur... |
text = match.group(self.groups.uri.whole) | text = match.group('whole') | def standalone_uri(self, match, lineno): scheme = self.groups.uri.scheme if not match.group(scheme) or urischemes.schemes.has_key( match.group(scheme).lower()): if match.group(self.groups.uri.email): addscheme = 'mailto:' else: addscheme = '' text = match.group(self.groups.uri.whole) unescaped = unescape(text, 0) retur... |
(?: _ | (`?) (?![ `]) ( | ( _ | (?P<quote>`?) (?![ `]) (?P<name> | def build_table_row(self, rowdata, tableline): row = nodes.row() for cell in rowdata: if cell is None: continue morerows, morecols, offset, cellblock = cell attributes = {} if morerows: attributes['morerows'] = morerows if morecols: attributes['morecols'] = morecols entry = nodes.entry(**attributes) row += entry if ''.... |
%s \1 | %s (?P=quote) | def build_table_row(self, rowdata, tableline): row = nodes.row() for cell in rowdata: if cell is None: continue morerows, morecols, offset, cellblock = cell attributes = {} if morerows: attributes['morerows'] = morerows if morecols: attributes['morecols'] = morecols entry = nodes.entry(**attributes) row += entry if ''.... |
%s : (?:[ ]+|$) | %s : ([ ]+|$) | def build_table_row(self, rowdata, tableline): row = nodes.row() for cell in rowdata: if cell is None: continue morerows, morecols, offset, cellblock = cell attributes = {} if morerows: attributes['morerows'] = morerows if morecols: attributes['morecols'] = morecols entry = nodes.entry(**attributes) row += entry if ''.... |
(?: (%s)_ | ` (?![ ]) (.+?) %s `_ | ( (?P<simple>%s)_ | ` (?![ ]) (?P<phrase>.+?) %s `_ | def build_table_row(self, rowdata, tableline): row = nodes.row() for cell in rowdata: if cell is None: continue morerows, morecols, offset, cellblock = cell attributes = {} if morerows: attributes['morerows'] = morerows if morecols: attributes['morecols'] = morecols entry = nodes.entry(**attributes) row += entry if ''.... |
(?: (?![ ]) (.+?) %s \| | ( (?![ ]) (?P<name>.+?) %s \| | def build_table_row(self, rowdata, tableline): row = nodes.row() for cell in rowdata: if cell is None: continue morerows, morecols, offset, cellblock = cell attributes = {} if morerows: attributes['morerows'] = morerows if morecols: attributes['morecols'] = morecols entry = nodes.entry(**attributes) row += entry if ''.... |
(?:[ ]+|$) | ([ ]+|$) | def build_table_row(self, rowdata, tableline): row = nodes.row() for cell in rowdata: if cell is None: continue morerows, morecols, offset, cellblock = cell attributes = {} if morerows: attributes['morerows'] = morerows if morecols: attributes['morecols'] = morecols entry = nodes.entry(**attributes) row += entry if ''.... |
explicit.groups = Stuff( target=Stuff(quote=1, name=2), reference=Stuff(simple=1, phrase=2), substitution=Stuff(name=1)) | def build_table_row(self, rowdata, tableline): row = nodes.row() for cell in rowdata: if cell is None: continue morerows, morecols, offset, cellblock = cell attributes = {} if morerows: attributes['morerows'] = morerows if morecols: attributes['morecols'] = morecols entry = nodes.entry(**attributes) row += entry if ''.... | |
namegroup = self.explicit.groups.target.name | def hyperlink_target(self, match): pattern = self.explicit.patterns.target namegroup = self.explicit.groups.target.name lineno = self.state_machine.abs_line_number() block, indent, offset, blank_finish = \ self.state_machine.get_first_known_indented( match.end(), until_blank=1, strip_indent=0) blocktext = match.string[... | |
self.add_target(targetmatch.group(namegroup), '', target) | self.add_target(targetmatch.group('name'), '', target) | def hyperlink_target(self, match): pattern = self.explicit.patterns.target namegroup = self.explicit.groups.target.name lineno = self.state_machine.abs_line_number() block, indent, offset, blank_finish = \ self.state_machine.get_first_known_indented( match.end(), until_blank=1, strip_indent=0) blocktext = match.string[... |
self.add_target(targetmatch.group(namegroup), unescaped, target) | self.add_target(targetmatch.group('name'), unescaped, target) | def hyperlink_target(self, match): pattern = self.explicit.patterns.target namegroup = self.explicit.groups.target.name lineno = self.state_machine.abs_line_number() block, indent, offset, blank_finish = \ self.state_machine.get_first_known_indented( match.end(), until_blank=1, strip_indent=0) blocktext = match.string[... |
return unescape(match.group(self.explicit.groups.reference.simple) or match.group(self.explicit.groups.reference.phrase)) | return unescape(match.group('simple') or match.group('phrase')) | def is_reference(self, reference): match = self.explicit.patterns.reference.match(normalize_name(reference)) if not match: return None return unescape(match.group(self.explicit.groups.reference.simple) or match.group(self.explicit.groups.reference.phrase)) |
subname = subdefmatch.group(self.explicit.groups.substitution.name) | subname = subdefmatch.group('name') | def substitution_def(self, match): pattern = self.explicit.patterns.substitution lineno = self.state_machine.abs_line_number() block, indent, offset, blank_finish = \ self.state_machine.get_first_known_indented(match.end(), strip_indent=0) blocktext = (match.string[:match.end()] + '\n'.join(block)) block = [escape2null... |
(?:[ ]+|$) | ([ ]+|$) | 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()) text = '\n'.join(indented)... |
reader_name='doctree', source_class=io.DocTreeInput, source=doctree, source_path='test', writer_name='html') | reader_name='doctree', source_class=io.DocTreeInput, source=doctree, source_path='test', writer_name='html', settings_spec=self) | def test_publish_doctree(self): # Test `publish_doctree` and `publish_from_doctree`. |
if (self.use_verbatim_for_literal): self.body.append('\\end{verbatim}\n') else: | if not self.use_verbatim_for_literal: | def depart_literal_block(self, node): if (self.use_verbatim_for_literal): self.body.append('\\end{verbatim}\n') else: self.body.append('}\n') |
if atts.has_key('id'): | if atts.has_key('id') and self.named_tags.has_key(tagname): | def starttag(self, node, tagname, suffix='\n', infix='', **attributes): """ Construct and return a start tag given a node (id & class attributes are extracted), tag name, and optional attributes. """ atts = {} for (name, value) in attributes.items(): atts[name.lower()] = value for att in ('class',): # append t... |
parts = [tagname.lower()] | parts = [tagname] | def starttag(self, node, tagname, suffix='\n', infix='', **attributes): """ Construct and return a start tag given a node (id & class attributes are extracted), tag name, and optional attributes. """ atts = {} for (name, value) in attributes.items(): atts[name.lower()] = value for att in ('class',): # append t... |
context = '' | atts = {'name': node.parent['id']} | def visit_title(self, node): """Only 6 section levels are supported by HTML.""" if isinstance(node.parent, nodes.topic): self.body.append( self.starttag(node, 'p', '', CLASS='topic-title')) self.context.append('</p>\n') elif self.section_level == 0: # document title self.head.append('<title>%s</title>\n' % self.encode(... |
self.body.append('<a class="toc-backref" href=" % node['refid']) context = '</a>' self.context.append('%s</h%s>\n' % (context, self.section_level)) | atts['class'] = 'toc-backref' atts['href'] = ' self.body.append(self.starttag({}, 'a', '', **atts) self.context.append('</a></h%s>\n' % (self.section_level)) | def visit_title(self, node): """Only 6 section levels are supported by HTML.""" if isinstance(node.parent, nodes.topic): self.body.append( self.starttag(node, 'p', '', CLASS='topic-title')) self.context.append('</p>\n') elif self.section_level == 0: # document title self.head.append('<title>%s</title>\n' % self.encode(... |
raw_file = open(options['file']) | raw_file = open(path) | def raw(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """ Pass through content unchanged Content is included in output based on type argument Content may be included inline (content section of directive) or imported from a file or url. """ attributes = {'format': argume... |
attributes['source'] = options['file'] | attributes['source'] = path | def raw(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """ Pass through content unchanged Content is included in output based on type argument Content may be included inline (content section of directive) or imported from a file or url. """ attributes = {'format': argume... |
text = text.replace("\\", '{\\textbackslash}') | if not self.__dict__.has_key('encode_re_braces'): self.encode_re_braces = re.compile(r'([{}])') text = self.encode_re_braces.sub(r'{\\\1}',text) if not self.__dict__.has_key('encode_re_bslash'): self.encode_re_bslash = re.compile(r'(?<!{)(\\)(?![{}]})') text = self.encode_re_bslash.sub(r'{\\textbackslash}', text) | def encode(self, text): """ Encode special characters in `text` & return. # $ % & ~ _ ^ \ { } Escaping with a backslash does not help with backslashes, ~ and ^. |
self.body.append('\\includegraphics{%s}\n' % href) | self.body.append('\n\\includegraphics{%s}\n' % href) | def visit_image(self, node): atts = node.attributes.copy() href = atts['uri'] ##self.body.append('\\begin{center}\n') self.body.append('\\includegraphics{%s}\n' % href) ##self.body.append('\\end{center}\n') |
self.body.append('\\ttfamily{\\begin{flushleft}\n\\mbox{') | self.body.append('\\begin{ttfamily}\\begin{flushleft}\n\\mbox{') | def visit_literal_block(self, node): """ .. parsed-literal:: """ # typically in a typewriter/monospaced typeface. # care must be taken with the text, because inline markup is recognized. # # possibilities: # * verbatim: is no possibility, as inline markup does not work. # * obey..: is from julien and never worked for m... |
self.body.append('}\n\\end{flushleft}}\n') | self.body.append('}\n\\end{flushleft}\\end{ttfamily}\n') | def depart_literal_block(self, node): if self.use_for_literal_block == "verbatim": self.body.append('\n\\end{verbatim}\n') self.verbatim = 0 elif (self.use_for_literal_block == "mbox"): self.body.append('}\n\\end{flushleft}}\n') self.mbox_newline = 0 else: self.body.append('}\n') |
include.options = {'literal': directives.flag} | include.options = {'literal': directives.flag, 'encoding': directives.encoding} | def include(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """Include a reST file as part of the content of this reST file.""" source = state_machine.input_lines.source( lineno - state_machine.input_offset - 1) source_dir = os.path.dirname(os.path.abspath(source)) path = '... |
'url': directives.path} | 'url': directives.path, 'encoding': directives.encoding} | def raw(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): """ Pass through content unchanged Content is included in output based on type argument Content may be included inline (content section of directive) or imported from a file or url. """ attributes = {'format': ' '.jo... |
if self.record_dependencies is None: | if (not hasattr(self, 'record_dependencies') or self.record_dependencies is None): | def __init__(self, *args, **kwargs): optparse.Values.__init__(self, *args, **kwargs) if self.record_dependencies is None: # Set up dependency list, in case it is needed. self.record_dependencies = docutils.utils.DependencyList() |
if isinstance(node.parent, nodes.footnote) and \ not self.use_latex_footnotes: | if isinstance(node.parent, nodes.footnote): if self.use_latex_footnotes: raise nodes.SkipNode | def label_delim(self, node, bracket, superscript): if isinstance(node.parent, nodes.footnote) and \ not self.use_latex_footnotes: if self.settings.footnote_references == 'brackets': self.body.append(bracket) else: self.body.append(superscript) elif isinstance(node.parent, nodes.citation) and \ not self._use_latex_citat... |
elif isinstance(node.parent, nodes.citation) and \ not self._use_latex_citations: self.body.append(bracket) | else: assert isinstance(node.parent, nodes.citation) if not self._use_latex_citations: self.body.append(bracket) | def label_delim(self, node, bracket, superscript): if isinstance(node.parent, nodes.footnote) and \ not self.use_latex_footnotes: if self.settings.footnote_references == 'brackets': self.body.append(bracket) else: self.body.append(superscript) elif isinstance(node.parent, nodes.citation) and \ not self._use_latex_citat... |
node_list = nodes.reference(refuri=data) | reference = nodes.reference(refuri=data) | def image(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): reference = ''.join(arguments[0].split('\n')) if reference.find(' ') != -1: error = state_machine.reporter.error( 'Image URI contains whitespace.', nodes.literal_block(block_text, block_text), line=lineno) return [er... |
node_list = nodes.reference( | reference = nodes.reference( | def image(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): reference = ''.join(arguments[0].split('\n')) if reference.find(' ') != -1: error = state_machine.reporter.error( 'Image URI contains whitespace.', nodes.literal_block(block_text, block_text), line=lineno) return [er... |
state.document.note_refname(node_list) | state.document.note_refname(reference) | def image(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): reference = ''.join(arguments[0].split('\n')) if reference.find(' ') != -1: error = state_machine.reporter.error( 'Image URI contains whitespace.', nodes.literal_block(block_text, block_text), line=lineno) return [er... |
node_list = [data] | reference = [data] | def image(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): reference = ''.join(arguments[0].split('\n')) if reference.find(' ') != -1: error = state_machine.reporter.error( 'Image URI contains whitespace.', nodes.literal_block(block_text, block_text), line=lineno) return [er... |
node_list = [] node_list.append(nodes.image(block_text, **options)) return node_list | reference = None image_node = nodes.image(block_text, **options) if reference: reference += image_node return [reference] else: return [image_node] | def image(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): reference = ''.join(arguments[0].split('\n')) if reference.find(' ') != -1: error = state_machine.reporter.error( 'Image URI contains whitespace.', nodes.literal_block(block_text, block_text), line=lineno) return [er... |
name = 'visit_' + self.__class__.__name__ method = getattr(visitor, name, visitor.unknown_visit) visitor.document.reporter.debug(name, category='nodes.Node.walk') | visitor.document.reporter.debug(self.__class__.__name__, category='nodes.Node.walk') | def walk(self, visitor): """ Traverse a tree of `Node` objects, calling ``visit_...`` methods of `visitor` when entering each node. If there is no ``visit_particular_node`` method for a node of type ``particular_node``, the ``unknown_visit`` method is called. (The `walkabout()` method is similar, except it also calls ... |
method(self) | visitor.dispatch_visit(self, self.__class__.__name__) | def walk(self, visitor): """ Traverse a tree of `Node` objects, calling ``visit_...`` methods of `visitor` when entering each node. If there is no ``visit_particular_node`` method for a node of type ``particular_node``, the ``unknown_visit`` method is called. (The `walkabout()` method is similar, except it also calls ... |
name = 'visit_' + self.__class__.__name__ method = getattr(visitor, name, visitor.unknown_visit) visitor.document.reporter.debug(name, category='nodes.Node.walkabout') | visitor.document.reporter.debug(self.__class__.__name__, category='nodes.Node.walkabout') | def walkabout(self, visitor): """ Perform a tree traversal similarly to `Node.walk()` (which see), except also call ``depart_...`` methods before exiting each node. If there is no ``depart_particular_node`` method for a node of type ``particular_node``, the ``unknown_departure`` method is called. |
method(self) | visitor.dispatch_visit(self, self.__class__.__name__) | def walkabout(self, visitor): """ Perform a tree traversal similarly to `Node.walk()` (which see), except also call ``depart_...`` methods before exiting each node. If there is no ``depart_particular_node`` method for a node of type ``particular_node``, the ``unknown_departure`` method is called. |
name = 'depart_' + self.__class__.__name__ method = getattr(visitor, name, visitor.unknown_departure) visitor.document.reporter.debug( name, category='nodes.Node.walkabout') method(self) | visitor.document.reporter.debug(self.__class__.__name__, category='nodes.Node.walkabout') visitor.dispatch_depart(self, self.__class__.__name__) | def walkabout(self, visitor): """ Perform a tree traversal similarly to `Node.walk()` (which see), except also call ``depart_...`` methods before exiting each node. If there is no ``depart_particular_node`` method for a node of type ``particular_node``, the ``unknown_departure`` method is called. |
visitor.dispatch_visit(self, self.__class__.__name__) | visitor.dispatch_visit(self) | def walk(self, visitor): """ Traverse a tree of `Node` objects, calling ``visit_...`` methods of `visitor` when entering each node. If there is no ``visit_particular_node`` method for a node of type ``particular_node``, the ``unknown_visit`` method is called. (The `walkabout()` method is similar, except it also calls ... |
Can we handle this without having to add the inline? | def visit_image(self, node): """ Need to intervene in the case of inline images. We need MoinMoin to give us the actual src line to the image and then we can feed this to the default html4css1 writer. NOTE: Since the writer can't "open" this image the scale attribute doesn't work without directly specifying the height ... | |
if uri.startswith('inline:'): | prefix = '' if ':' in uri: prefix = uri.split(':',1)[0] if not prefix.lower() in ('file','http','https',): if not prefix: node['uri'] = 'inline:' + uri | def visit_image(self, node): """ Need to intervene in the case of inline images. We need MoinMoin to give us the actual src line to the image and then we can feed this to the default html4css1 writer. NOTE: Since the writer can't "open" this image the scale attribute doesn't work without directly specifying the height ... |
def visit_func(node): | def visit_func(self, node): | def visit_func(node): self.wiki_text = '' self.request.write(moin_callable(1)) self.body.append(self.wiki_text) |
def depart_func(node): | def depart_func(self, node): | def depart_func(node): self.wiki_text = '' self.request.write(moin_callable(0)) self.body.append(self.wiki_text) |
Set up & run a `Publisher` to render from an existing document tree data structure, for programmatic use with string I/O. Return a pair of encoded string output and document parts. | Set up & run a `Publisher` to render from an existing document tree data structure, for programmatic use with string I/O. Return the encoded string output. | def publish_from_doctree(document, destination_path=None, writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=None): """ Set up & run a `Publisher` to render from an existing document tree data structure, for programmatic use with str... |
self.debug = debug | self.debug_flag = debug | def set_conditions(self, category, report_level, halt_level, stream=None, debug=0): warnings.warn('docutils.utils.Reporter.set_conditions deprecated; ' 'set attributes via configuration settings or directly', DeprecationWarning, stacklevel=2) self.report_level = report_level self.halt_level = halt_level if stream is No... |
href = ' | href = hash_char + node['refid'] | def visit_reference(self, node): # for pdflatex hyperrefs might be supported if node.has_key('refuri'): href = node['refuri'] elif node.has_key('refid'): href = '#' + node['refid'] elif node.has_key('refname'): href = '#' + self.document.nameids[node['refname']] ##self.body.append('[visit_reference]') self.body.append(... |
href = ' | href = hash_char + self.document.nameids[node['refname']] | def visit_reference(self, node): # for pdflatex hyperrefs might be supported if node.has_key('refuri'): href = node['refuri'] elif node.has_key('refid'): href = '#' + node['refid'] elif node.has_key('refname'): href = '#' + self.document.nameids[node['refname']] ##self.body.append('[visit_reference]') self.body.append(... |
'docutils.parsers', 'docutils.parsers.restructuredtext', 'docutils.parsers.restructuredtext.directives', 'docutils.parsers.restructuredtext.languages']) | 'docutils.parsers', 'docutils.parsers.rst', 'docutils.parsers.rst.directives', 'docutils.parsers.rst.languages']) | def do_setup(): dist = setup( name = 'Docutils', description = 'Python Documentation Utilities', #long_description = '', url = 'http://docutils.sourceforge.net/', version = 'pre-0.1', author = 'David Goodger', author_email = 'goodger@users.sourceforge.net', license = 'public domain, Python (see COPYING.txt)', packages ... |
of the original `document` document, pass settings=document.settings. | of the original `document`, pass settings=document.settings. | def publish_from_doctree(document, destination_path=None, writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=None): """ Set up & run a `Publisher` to render from an existing document tree data structure, for programmatic use with str... |
Parameters: see `publish_programmatically`. | Parameters: `document` is a `docutils.nodes.document` object, an existing document tree. Other parameters: see `publish_programmatically`. | def publish_from_doctree(document, destination_path=None, writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=None): """ Set up & run a `Publisher` to render from an existing document tree data structure, for programmatic use with str... |
entry_level = index_entry_level(level, *textnodes) | entry_level = index_entry_level(level, '', *textnodes) | def index_directive(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): #pending = nodes.pending(EffTransformer.Index, {'entries': content}) #state_machine.document.note_pending(pending) #return [pending] # XXX entries = [] message_set = [] for entry in content: levels = re_ind... |
source_parts = os.path.abspath(source or '').split(os.sep) | source_parts = os.path.abspath(source or 'dummy_file').split(os.sep) | def relative_path(source, target): """ Build and return a path to `target`, relative to `source`. If there is no common prefix, return the absolute path to `target`. """ source_parts = os.path.abspath(source or '').split(os.sep) target_parts = os.path.abspath(target).split(os.sep) # Check first 2 parts because '/dir'.... |
parts = ['..'] * len(source_parts) + target_parts | parts = ['..'] * (len(source_parts) - 1) + target_parts | def relative_path(source, target): """ Build and return a path to `target`, relative to `source`. If there is no common prefix, return the absolute path to `target`. """ source_parts = os.path.abspath(source or '').split(os.sep) target_parts = os.path.abspath(target).split(os.sep) # Check first 2 parts because '/dir'.... |
return docutils_encoding.translate(string.maketrans("",""),"_-").lower() | return docutils_encoding.replace("_", "").replace("-", "").lower() | def to_latex_encoding(self,docutils_encoding): """ Translate docutils encoding name into latex's. |
settings = {'output_encoding': 'iso-8859-1', '_disable_config': 1} | settings = {'output_encoding': 'iso-8859-1'} | def test_publish(self): settings = {'output_encoding': 'iso-8859-1', '_disable_config': 1} for settings['newlines'] in 0, 1: for settings['indents'] in 0, 1: for settings['xml_declaration'] in 0, 1: for settings['doctype_declaration'] in 0, 1: |
while not isinstance(startnode, nodes.Structural): | while not (isinstance(startnode, nodes.section) or isinstance(startnode, nodes.document)): | def apply(self): details = self.startnode.details if details.has_key('local'): startnode = self.startnode.parent.parent # @@@ generate an error if the startnode (directive) not at # section/document top-level? Drag it up until it is? while not isinstance(startnode, nodes.Structural): startnode = startnode.parent else: ... |
values = [str(v) for v in value] | values = [unicode(v) for v in value] | def starttag(self, node, tagname, suffix='\n', infix='', **attributes): """ Construct and return a start tag given a node (id & class attributes are extracted), tag name, and optional attributes. """ tagname = tagname.lower() atts = {} for (name, value) in attributes.items(): atts[name.lower()] = value for att in ('cla... |
self.attval(str(value)))) | self.attval(unicode(value)))) | def starttag(self, node, tagname, suffix='\n', infix='', **attributes): """ Construct and return a start tag given a node (id & class attributes are extracted), tag name, and optional attributes. """ tagname = tagname.lower() atts = {} for (name, value) in attributes.items(): atts[name.lower()] = value for att in ('cla... |
Insert a table of contents transform placeholder into the document after the RFC 2822 header. | Insert an empty table of contents topic and a transform placeholder into the document after the RFC 2822 header. | def apply(self): if not len(self.document): # @@@ replace these DataErrors with proper system messages raise DataError('Document tree is empty.') header = self.document[0] if not isinstance(header, nodes.field_list) or \ header.get('class') != 'rfc2822': raise DataError('Document does not begin with an RFC-2822 ' 'head... |
pending = nodes.pending(parts.Contents, {'title': None}) self.document.insert(1, pending) | language = languages.get_language(self.document.settings.language_code) name = language.labels['contents'] title = nodes.title('', name) topic = nodes.topic('', title, CLASS='contents') name = nodes.fully_normalize_name(name) if not self.document.has_name(name): topic['name'] = name self.document.note_implicit_target(t... | def apply(self): pending = nodes.pending(parts.Contents, {'title': None}) self.document.insert(1, pending) self.document.note_pending(pending) |
if self.string == '=': | if self.string == '=' and not self.stack: | def rhs(self, lineno): """ Return a whitespace-normalized expression string from the right-hand side of an assignment at line `lineno`. """ self.goto_line(lineno) while self.string != '=': self.next() while self.type != token.NEWLINE and self.string != ';': if self.string == '=': self.tokens = [] self.stack = [] self._... |
class WriterPublishTestCase(CustomTestCase): | class WriterPublishTestCase(CustomTestCase, docutils.SettingsSpec): | def generateTests(self, dict, dictname='totest', testmethod='test_parser'): """ Stock the suite with test cases generated from a test data dictionary. |
writer_name = '' | settings_default_overrides = {'strict_visitor': 1} writer_name = '' | def generateTests(self, dict, dictname='totest', testmethod='test_parser'): """ Stock the suite with test cases generated from a test data dictionary. |
self.writer_name = kwargs['writer_name'] del kwargs['writer_name'] | if kwargs.has_key('writer_name'): self.writer_name = kwargs['writer_name'] del kwargs['writer_name'] | def __init__(self, *args, **kwargs): self.writer_name = kwargs['writer_name'] del kwargs['writer_name'] CustomTestCase.__init__(self, *args, **kwargs) |
settings_overrides={'strict_visitor': 1}) | settings_spec=self) | def test_publish(self): if self.run_in_debugger: pdb.set_trace() output = docutils.core.publish_string( source=self.input, reader_name='standalone', parser_name='restructuredtext', writer_name=self.writer_name, settings_overrides={'strict_visitor': 1}) self.compare_output(self.input, output, self.expected) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.