Your IP : 216.73.216.213


Current Path : /opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pyc

�
���Lc@skdZdZddlmZmZmZdefd��YZddd��YZdefd	��YZd
S(s�
This package contains modules for standard tree transforms available
to Docutils components. Tree transforms serve a variety of purposes:

- To tie up certain syntax-specific "loose ends" that remain after the
  initial parsing of the input plaintext. These transforms are used to
  supplement a limited syntax.

- To automate the internal linking of the document tree (hyperlink
  references, footnote references, etc.).

- To extract useful information from the document tree. These
  transforms may be used to construct (for example) indexes and tables
  of contents.

Each transform is an optional step that a Docutils component may
choose to perform on the parsed document.
treStructuredTexti����(t	languagestApplicationErrort
TransformSpectTransformErrorcBseZRS((t__name__t
__module__(((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pyRst	TransformcBs)eZdZdZdd�Zd�ZRS(s;
    Docutils transform component abstract base class.
    cCs4||_||_tj|jj|j�|_dS(sA
        Initial setup for in-place document transforms.
        N(tdocumentt	startnodeRtget_languagetsettingst
language_codetreportertlanguage(tselfRR	((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pyt__init__*s
		cKstd��dS(s5Override to apply the transform to the document tree.s"subclass must override this methodN(tNotImplementedError(Rtkwargs((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pytapply;sN(RRt__doc__tNonetdefault_priorityRR(((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pyR!stTransformercBsSeZdZd�Zdd�Zd�Zdd�Zd�Zd�Z	d�Z
RS(	s�
    Stores transforms (`Transform` classes) and applies them to document
    trees.  Also keeps track of components by component type name.
    cCsCg|_g|_||_g|_d|_i|_d|_dS(Ni(t
transformstunknown_reference_resolversRtappliedtsortedt
componentstserialno(RR((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pyRGs							cKsP|dkr|j}n|j|�}|jj||d|f�d|_dS(s+
        Store a single transform.  Use `priority` to override the default.
        `kwargs` is a dictionary whose contents are passed as keyword
        arguments to the `apply` method of the transform.  This can be used to
        pass application-specific data to the transform instance.
        iN(RRtget_priority_stringRtappendR(Rttransform_classtpriorityRtpriority_string((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pyt
add_transform`s	cCsLx<|D]4}|j|j�}|jj||dif�qWd|_dS(s3Store multiple transforms, with default priorities.iN(RRRRRR(Rttransform_listR R"((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pytadd_transformsns
	cCsY|j}|dkr!|j}n|j|�}|jj|||if�d|_dS(s4Store a transform with an associated `pending` node.iN(t	transformRRRRRR(RtpendingR!R R"((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pytadd_pendingws		cCs |jd7_d||jfS(s�
        Return a string, `priority` combined with `self.serialno`.

        This ensures FIFO order on transforms with identical priority.
        is	%03d-%03d(R(RR!((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pyR�scCs�xC|D];}|dkrqn|j|j��||j|j<qWd|_g}x|D]}|j|j�q\Wg|D]}|j|f^q}}|j	�|jjg|D]}|d^q��dS(s�
        Store each component's default transforms, with default priorities.
        Also, store components by type name in a mapping for later lookup.
        iiN(
RR%tget_transformsRtcomponent_typeRtextendRR!tsort(RRt	componentRtitftdecorated_list((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pytpopulate_from_components�s
	
"
cCs�|jjj|jj�x�|jr�|jsT|jj�|jj�d|_n|jj�\}}}}||jd|�}|j	|�|j
j||||f�qWdS(s6Apply all of the stored transforms, in priority order.iR	N(RR
tattach_observertnote_transform_messageRRR,treversetpopRRR(RR!R R'RR&((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pytapply_transforms�s
	


N(RRRRRR#R%R(RR1R6(((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pyR@s			
			N((	Rt
__docformat__tdocutilsRRRRRR(((sM/opt/alt/python27/lib/python2.7/site-packages/docutils/transforms/__init__.pyt<module>s