
    dd                     \    d Z dZddlZddlmZmZ ddlmZ  G d de      Z G d d	e      Z	y)
z
Auxiliary transforms mainly to be used by Writer components.

This module is called "writer_aux" because otherwise there would be
conflicting imports like this one::

    from docutils import writers
    from docutils.transforms import writers
reStructuredText    N)nodes	languages)	Transformc                   .     e Zd ZdZdZd fd	Zd Z xZS )Compounda  
    .. warning:: This transform is not used by Docutils since Dec 2010
                 and will be removed in Docutils 0.21 or later.

    Flatten all compound paragraphs.  For example, transform ::

        <compound>
            <paragraph>
            <literal_block>
            <paragraph>

    into ::

        <paragraph>
        <literal_block classes="continued">
        <paragraph classes="continued">
    i  c                 ^    t        j                  dt        d       t        |   ||       y )Nzddocutils.transforms.writer_aux.Compound is deprecated and will be removed in Docutils 0.21 or later.   )
stacklevel)warningswarnDeprecationWarningsuper__init__)selfdocument	startnode	__class__s      @/usr/lib/python3/dist-packages/docutils/transforms/writer_aux.pyr   zCompound.__init__-   s+     H(Q	8 	9-    c                    | j                   j                  t        j                        D ]S  }d}|D ]6  }|rt	        |t        j
                        r d}#|d   j                  d       8 |j                  |d d         U y )NTFclasses	continued)r   findallr   compound
isinstance	Invisibleappendreplace_self)r   r   first_childchilds       r   applyzCompound.apply3   su    --enn= 		/HK! 9%eU__=&+)$++K89 !!(1+.		/r   )N)__name__
__module____qualname____doc__default_priorityr   r"   __classcell__)r   s   @r   r   r      s    $ .
/r   r   c                       e Zd ZdZdZd Zy)AdmonitionsaZ  
    Transform specific admonitions, like this:

        <note>
            <paragraph>
                 Note contents ...

    into generic admonitions, like this::

        <admonition classes="note">
            <title>
                Note
            <paragraph>
                Note contents ...

    The admonition title is localized.
    i  c                 t   t        j                  | j                  j                  j                  | j                  j
                        }| j                  j                  t        j                        D ]  }|j                  j                  }|d   j                  |       t        |t        j                        rHt        j                  |j                  g|j                  i |j                   }t        j"                  d|j$                  |         }|j'                  d|       |j)                  |        y )Nr    r   )r   get_languager   settingslanguage_codereporterr   r   
Admonitionr   r#   r   r   
admonition	rawsourcechildren
attributestitlelabelsinsertr   )r   languagenode	node_namer2   r6   s         r   r"   zAdmonitions.applyV   s    ))$--*@*@*N*N*.--*@*@BMM))%*:*:; 
	.D//IO""9-dE$4$45"--dnn At}} A04A
B	(BC!!!U+!!*-
	.r   N)r#   r$   r%   r&   r'   r"    r   r   r*   r*   @   s    $ .r   r*   )
r&   __docformat__r   docutilsr   r   docutils.transformsr   r   r*   r<   r   r   <module>r@      s3   
 #  % )&/y &/R#.) #.r   