Module docfixer
[hide private]
[frames] | no frames]

Module docfixer

Perform massive transformations on a document tree created from the LaTeX of the Python documentation, and dump the ESIS data for the transformed tree.

Classes [hide private]
ConversionError
Functions [hide private]
 
para_msg(s)
 
get_first_element(doc, gi)
 
extract_first_element(doc, gi)
 
get_documentElement(node)
 
set_tagName(elem, gi)
 
find_all_elements(doc, gi)
 
find_all_child_elements(doc, gi)
 
find_all_elements_from_set(doc, gi_set)
 
__find_all_elements_from_set(doc, gi_set, nodes)
 
simplify(doc, fragment)
 
cleanup_root_text(doc)
 
fixup_descriptors(doc, fragment)
 
find_and_fix_descriptors(doc, container)
 
rewrite_descriptor(doc, descriptor)
 
methodline_to_signature(doc, methodline)
 
move_children(origin, dest, start=0)
 
handle_appendix(doc, fragment)
 
handle_labels(doc, fragment)
 
fixup_trailing_whitespace(doc, fragment, wsmap)
 
normalize(doc)
 
cleanup_trailing_parens(doc, element_names)
 
contents_match(left, right)
 
create_module_info(doc, section)
 
cleanup_synopses(doc, fragment)
 
fixup_table_structures(doc, fragment)
 
fixup_table(doc, table)
 
fixup_row(doc, row)
 
move_elements_by_name(doc, source, dest, name, sep=None)
 
fixup_paras(doc, fragment)
 
fixup_paras_helper(doc, container, depth=0)
 
build_para(doc, parent, start, i)
 
skip_leading_nodes(children, start=0)
Return index into children of a node at which paragraph building should begin or a recursive call to fixup_paras_helper() should be made (for subsections, etc.).
 
fixup_rfc_references(doc, fragment)
 
fixup_signatures(doc, fragment)
 
rewrite_args(doc, arglist)
 
fixup_args(doc, arglist)
 
fixup_sectionauthors(doc, fragment)
 
fixup_verbatims(doc)
 
add_node_ids(fragment, counter=0)
 
fixup_ulink(doc, fragment)
 
fixup_refmodindexes(fragment)
 
fixup_refmodindexes_chunk(container)
 
fixup_bifuncindexes(fragment)
 
fixup_bifuncindexes_chunk(container)
 
join_adjacent_elements(container, gi)
 
write_esis(doc, ofp, knownempty)
 
convert(ifp, ofp)
 
main()
Variables [hide private]
  ELEMENT = 1
  ENTITY_REFERENCE = 5
  TEXT = 3
  PARA_ELEMENT = 'para'
  DEBUG_PARA_FIXER = 0
  DESCRIPTOR_ELEMENTS = ('cfuncdesc', 'cvardesc', 'ctypedesc', '...
  RECURSE_INTO_PARA_CONTAINERS = ('chapter', 'abstract', 'enumer...
  PARA_LEVEL_ELEMENTS = ('moduleinfo', 'title', 'verbatim', 'enu...
  PARA_LEVEL_PRECEEDERS = ('setindexsubitem', 'author', 'stindex...
  REFMODINDEX_ELEMENTS = ('refmodindex', 'refbimodindex', 'refex...
  _token_rx = re.compile(r'[a-zA-Z][a-zA-Z0-9\.-]*$')

Imports: errno, esistools, re, sys, xml, ewrite, commands, bwrite


Function Details [hide private]

skip_leading_nodes(children, start=0)

 

Return index into children of a node at which paragraph building should begin or a recursive call to fixup_paras_helper() should be made (for subsections, etc.).

When the return value >= len(children), we've built all the paras we can from this list of children.


Variables Details [hide private]

DESCRIPTOR_ELEMENTS

Value:
('cfuncdesc',
 'cvardesc',
 'ctypedesc',
 'classdesc',
 'memberdesc',
 'memberdescni',
 'methoddesc',
 'methoddescni',
...

RECURSE_INTO_PARA_CONTAINERS

Value:
('chapter',
 'abstract',
 'enumerate',
 'section',
 'subsection',
 'subsubsection',
 'paragraph',
 'subparagraph',
...

PARA_LEVEL_ELEMENTS

Value:
('moduleinfo',
 'title',
 'verbatim',
 'enumerate',
 'item',
 'interpreter-session',
 'back-matter',
 'interactive-session',
...

PARA_LEVEL_PRECEEDERS

Value:
('setindexsubitem',
 'author',
 'stindex',
 'obindex',
 'COMMENT',
 'label',
 'xi:include',
 'title',
...

REFMODINDEX_ELEMENTS

Value:
('refmodindex', 'refbimodindex', 'refexmodindex', 'refstmodindex')