;
l@c           @   s   d  Z  d Z d k Z d k Z d k l Z l Z d k l Z l	 Z	 d e	 f d     YZ
 d e	 f d     YZ d	 e i f d
     YZ d S(   s'   
Transforms related to document parts.
s   reStructuredTextN(   s   nodess   utils(   s   TransformErrors	   Transforms   SectNumc           B   s,   t  Z d  Z d Z d   Z f  d d  Z RS(   sS  
    Automatically assigns numbers to the titles of document sections.

    It is possible to limit the maximum section level for which the numbers
    are added.  For those sections that are auto-numbered, the "autonum"
    attribute is set, informing the contents table generator that a different
    form of the TOC should be used.
    i  c         C   s\   |  i i i d t i  |  _ |  i i i |  i  |  i	 i
 i o |  i |  i	  n d  S(   Ns   depth(   s   selfs	   startnodes   detailss   gets   syss   maxints   maxdepths   parents   removes   documents   settingss   sectnum_xforms   update_section_numbers(   s   self(    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   apply"   s    i    c   	      C   s   | d 7} d } x | D] } t | t i  o | t |  f } | d } t i d d i |  d d d d } | i d |  d | d	 <| |  i j  o |  i | | |  n | d 7} q q Wd  S(
   Ni   i    s    s   .u    i   s   CLASSs   sectnums   auto(   s   depths   sectnums   nodes   childs
   isinstances   nodess   sections   prefixs   strs   numberss   titles	   generateds   joins   inserts   selfs   maxdepths   update_section_numbers(	   s   selfs   nodes   prefixs   depths   titles   sectnums   numberss   childs	   generated(    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   update_section_numbers(   s    
 
)
(   s   __name__s
   __module__s   __doc__s   default_prioritys   applys   update_section_numbers(    (    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   SectNum   s
   	  	s   Contentsc           B   s2   t  Z d  Z d Z d   Z d d  Z d   Z RS(   s  
    This transform generates a table of contents from the entire document tree
    or from a single branch.  It locates "section" elements and builds them
    into a nested bullet list, which is placed within a "topic" created by the
    contents directive.  A title is either explicitly specified, taken from
    the appropriate language module, or omitted (local table of contents).
    The depth may be specified.  Two-way references between the table of
    contents and section titles are generated (requires Writer support).

    This transform requires a startnode, which which contains generation
    options and provides the location for the generated table of contents (the
    startnode is replaced by the table of contents "topic").
    i  c         C   s   |  i i } | i d  o8 |  i i i } x/ t | t i  o | i } q. Wn
 |  i } |  i i d |  _	 | i d  o | d |  _
 n |  i i i |  _
 |  i |  } t |  o |  i i i |  i |  n |  i i i i |  i i  d  S(   Ns   locals   ids	   backlinks(   s   selfs	   startnodes   detailss   has_keys   parents
   isinstances   nodess
   Structurals   documents   toc_ids	   backlinkss   settingss   toc_backlinkss   build_contentss   contentss   lens   replaces   remove(   s   selfs	   startnodes   detailss   contents(    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   applyK   s     	i    c         C   s  | d 7} g  }	 t |  d } xD | d j o t | | t i  o |	 i | |  | d 8} q# W|	 i	   g  } d } |  i i i d t i  } x|	 D] } | d } | i d  }
 |  i |  } t i d d d | d | } |  i i |  } t i d d |  } t i d |  } |  i d j o | | d <n" |  i d	 j o |  i  | d <n | | j  o  |  i! | |  } | | 7} n | i |  q W| o2 t i# d |  } |
 o | i% d
  n | Sn g  Sd  S(   Ni   i    s   depths   autos    s   refids   ids   entrys   tops   auto-toc(&   s   levels   sectionss   lens   nodes   is
   isinstances   nodess   sections   appends   reverses   entriess   autonums   selfs	   startnodes   detailss   gets   syss   maxints   depths   titles   autos   copy_and_filters	   entrytexts	   references   documents   set_ids   ref_ids	   paragraphs   entrys	   list_items   items	   backlinkss   toc_ids   build_contentss   subsectss   bullet_lists   contentss	   set_class(   s   selfs   nodes   levels	   references   ref_ids   contentss   autonums   titles   subsectss   sectionss   autos   entriess   is   items   depths	   entrytexts   entrys   section(    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   build_contentsa   sD    
 $
 
c         C   s*   t  |  i  } | i |  | i   Sd S(   s@   Return a copy of a title, with references, images, etc. removed.N(   s   ContentsFilters   selfs   documents   visitors   nodes	   walkabouts   get_entry_text(   s   selfs   nodes   visitor(    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   copy_and_filter   s     (   s   __name__s
   __module__s   __doc__s   default_prioritys   applys   build_contentss   copy_and_filter(    (    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   Contents9   s
    	$s   ContentsFilterc           B   sM   t  Z d   Z d   Z d   Z d   Z d   Z e Z e Z e Z	 e Z
 RS(   Nc         C   s   |  i   i   Sd  S(   N(   s   selfs   get_tree_copys   get_children(   s   self(    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   get_entry_text   s    c         C   s   t  i  d  S(   N(   s   nodess   SkipNode(   s   selfs   node(    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   visit_citation_reference   s    c         C   s   t  i  d  S(   N(   s   nodess   SkipNode(   s   selfs   node(    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   visit_footnote_reference   s    c         C   s>   | i d  o! |  i i t i | d   n t i  d  S(   Ns   alt(   s   nodes   hasattrs   selfs   parents   appends   nodess   Texts   SkipNode(   s   selfs   node(    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   visit_image   s    !c         C   s   t  i  d  S(   N(   s   nodess   SkipDeparture(   s   selfs   node(    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys    ignore_node_but_process_children   s    (   s   __name__s
   __module__s   get_entry_texts   visit_citation_references   visit_footnote_references   visit_images    ignore_node_but_process_childrens   visit_interpreteds   visit_problematics   visit_references   visit_target(    (    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   ContentsFilter   s   					(   s   __doc__s   __docformat__s   res   syss   docutilss   nodess   utilss   docutils.transformss   TransformErrors	   Transforms   SectNums   Contentss   TreeCopyVisitors   ContentsFilter(
   s   TransformErrors   utilss   SectNums	   Transforms   __docformat__s   syss   res   nodess   ContentsFilters   Contents(    (    sN   /mit/golem/arch/share/lib/python2.3/site-packages/docutils/transforms/parts.pys   ?	   s   		%S