HEX
Server: Apache
System: Linux pdx1-shared-a1-29 6.18.39-grsec-noble+ #4 SMP Thu Jul 23 07:53:29 UTC 2026 x86_64
User: dh_bj99yp (22285841)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/docutils/transforms/__pycache__/references.cpython-312.pyc
�

�ddӏ��.�dZdZddlmZmZddlmZGd�de�ZGd�de�ZGd	�d
e�Z	Gd�de�Z
Gd
�de�ZGd�de�ZGd�de
�ZGd�de�ZGd�de�ZGd�de�ZGd�dej$�Zy)z&
Transforms for resolving references.
�reStructuredText�)�nodes�utils)�	Transformc��eZdZdZdZd�Zy)�PropagateTargetsa}
    Propagate empty internal targets to the next element.

    Given the following nodes::

        <target ids="internal1" names="internal1">
        <target anonymous="1" ids="id1">
        <target ids="internal2" names="internal2">
        <paragraph>
            This is a test.

    PropagateTargets propagates the ids and names of the internal
    targets preceding the paragraph to the paragraph itself::

        <target refid="internal1">
        <target anonymous="1" refid="id1">
        <target refid="internal2">
        <paragraph ids="internal2 id1 internal1" names="internal2 internal1">
            This is a test.
    ic��|jjtj�D�]-}t	|j
tj�s3|jd�s"|jd�s|jd�r�\t|�dk(sJd��|jd��}t	|tj�r.|jdd�	�}t	|tj�r�.|�Dt	|tjtjf�rt	|tj�s��|d
j|d
�|dj|d�t|d�si|_t|d
�si|_|d
D]*}||jj |<||j|<�,|dD]}||j|<�|jj#t%|di��|jj#t%|d
i��|d
d|d<g|d
<g|d<|jj'|���0y)N�refid�refuri�refnamerz&error: block-level target has childrenT)�ascendF)r
�descend�ids�names�expect_referenced_by_name�expect_referenced_by_id)�document�findallr�target�
isinstance�parent�TextElement�hasattr�len�	next_node�system_message�	Invisible�
Targetable�extendrrr�update�getattr�
note_refid)�selfrr�id�names     �@/usr/lib/python3/dist-packages/docutils/transforms/references.py�applyzPropagateTargets.apply(s'���m�m�+�+�E�L�L�9�-	-�F��6�=�=�%�*;�*;�<��N�N�7�+�v�~�~�h�/G��~�~�i�0���v�;�!�#�M�%M�M�#��(�(��(�5�I��Y��(<�(<�=�%�/�/�t�U�/�K�	��Y��(<�(<�=��!��i�%�/�/�5�;K�;K�)L�M�"�9�e�l�l�;���e��#�#�F�5�M�2��g��%�%�f�W�o�6��9�&A�B�68�	�3��9�&?�@�46�	�1��U�m�
?��(1��
�
�!�!�"�%�9?�	�1�1�"�5�
?��w��
C��<B�	�3�3�D�9�
C�
�/�/�6�6��� ;�R�@�
B��-�-�4�4��� 9�2�>�
@�%�U�m�A�.�F�7�O��F�5�M� �F�7�O��M�M�$�$�V�,�[-	-�N��__name__�
__module__�__qualname__�__doc__�default_priorityr'�r(r&rrs���*��.-r(rc��eZdZdZdZd�Zy)�AnonymousHyperlinksa�
    Link anonymous references to targets.  Given::

        <paragraph>
            <reference anonymous="1">
                internal
            <reference anonymous="1">
                external
        <target anonymous="1" ids="id1">
        <target anonymous="1" ids="id2" refuri="http://external">

    Corresponding references are linked via "refid" or resolved via "refuri"::

        <paragraph>
            <reference anonymous="1" refid="id1">
                text
            <reference anonymous="1" refuri="http://external">
                external
        <target anonymous="1" ids="id1">
        <target anonymous="1" ids="id2" refuri="http://external">
    i�c��g}g}|jjtj�D]%}|j	d�s�|j|��'|jjtj�D]%}|j	d�s�|j|��'t|�t|�k7r�|jjjdt|��dt|��d��}|jj|�}|D]k}tj|j|j|��}|jj|�}|j|�|j|��myt||�D]v\}}	d|	_	|	j#d�r|	d|d<d|_�/|	ds|jj&|	d	}	�D|	dd
|d	<|jj)|��xy)N�	anonymouszAnonymous hyperlink mismatch: z references but z+ targets.
See "backrefs" attribute for IDs.�r
�rrr
r)rrr�	reference�get�appendrr�reporter�error�set_id�problematic�	rawsource�add_backref�replace_self�zip�
referencedr�resolvedrr")
r#�anonymous_refs�anonymous_targets�node�msg�msgid�ref�prb�prbidrs
          r&r'zAnonymousHyperlinks.applyss��������M�M�)�)�%�/�/�:�	,�D��x�x��$��%�%�d�+�	,��M�M�)�)�%�,�,�7�	/�D��x�x��$�!�(�(��.�	/��~��#�&7�"8�8��-�-�(�(�.�.���(�#�.?�*@�B�C�C��M�M�(�(��-�E�%�
&���'�'��m�m�S�]�]�%�A���
�
�,�,�S�1������&�� � ��%�
&�
��~�/@�A�	�K�C�� !�F����>�>�(�+�$*�8�$4�C��M�#$�C�L��!�%�=�!%���!2�!2�6�'�?�!C�� �#)�%�=��#3�C��L��M�M�,�,�S�1��	r(Nr)r/r(r&r1r1Ys���,��$r(r1c�8�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�IndirectHyperlinksaN
    a) Indirect external references::

           <paragraph>
               <reference refname="indirect external">
                   indirect external
           <target id="id1" name="direct external"
               refuri="http://indirect">
           <target id="id2" name="indirect external"
               refname="direct external">

       The "refuri" attribute is migrated back to all indirect targets
       from the final direct target (i.e. a target not referring to
       another indirect target)::

           <paragraph>
               <reference refname="indirect external">
                   indirect external
           <target id="id1" name="direct external"
               refuri="http://indirect">
           <target id="id2" name="indirect external"
               refuri="http://indirect">

       Once the attribute is migrated, the preexisting "refname" attribute
       is dropped.

    b) Indirect internal references::

           <target id="id1" name="final target">
           <paragraph>
               <reference refname="indirect internal">
                   indirect internal
           <target id="id2" name="indirect internal 2"
               refname="final target">
           <target id="id3" name="indirect internal"
               refname="indirect internal 2">

       Targets which indirectly refer to an internal target become one-hop
       indirect (their "refid" attributes are directly set to the internal
       target's "id"). References which indirectly refer to an internal
       target become direct internal references::

           <target id="id1" name="final target">
           <paragraph>
               <reference refid="id1">
                   indirect internal
           <target id="id2" name="indirect internal 2" refid="id1">
           <target id="id3" name="indirect internal" refid="id1">
    i�c��|jjD]0}|js|j|�|j	|��2y�N)r�indirect_targetsrB�resolve_indirect_target�resolve_indirect_references�r#rs  r&r'zIndirectHyperlinks.apply�s>���m�m�4�4�	5�F��?�?��,�,�V�4��,�,�V�4�	5r(c�n�|jd�}|�|d}nh|jjj|�}|sA|jjjD]}||�s�y|j|�y|jj|}|j|��t|tj�rU|jsI|jd�r8t|d�r|j|�yd|_|j|�|`|jd�r|d|d<d|vrq|d=nm|jd�r$|d|d<|jj!|�n8|dr!||d<|jj!|�n|j|�y|�|d=d|_y)Nrr
�r$�multiply_indirectr5rr)r7r�nameids�transformer�unknown_reference_resolvers�nonexistent_indirect_targetr�note_referenced_byrrrrBr�circular_indirect_referencerUrPr")r#rr�reftarget_id�resolver_function�	reftargets      r&rPz*IndirectHyperlinks.resolve_indirect_target�s����*�*�Y�'���?�!�'�?�L��=�=�0�0�4�4�W�=�L���
�
�1�1�M�M�=�%�(��0���
=�
�4�4�V�<���M�M�%�%�l�3�	��$�$��$�5��y�%�,�,�/��&�&��!�!�)�,��v�2�3��0�0��8��'(�F�$��(�(��3��(����X�&�(��2�F�8���&� ��7�O�
�
�
�w�
'�'��0�F�7�O��M�M�$�$�V�,����".��w���
�
�(�(��0��0�0��8�����y�!���r(c��|d|jjvr|j|d�y|j|d�y)Nrz>which is a duplicate, and cannot be used as a unique referencezwhich does not exist)rrV�indirect_target_errorrRs  r&rYz.IndirectHyperlinks.nonexistent_indirect_targetsC���)���
�
� 5� 5�5��&�&�v�0N�
O�
�&�&�v�/E�Fr(c�(�|j|d�y)Nzforming a circular reference)r`rRs  r&r[z.IndirectHyperlinks.circular_indirect_reference	s���"�"�6�+I�Jr(c	��d}g}|drd|ddz}|dD]7}|j|jjj|g���9|dD]7}|j|jjj|g���9|dr|d|ddzz
}|jj
j
d|�d|d	�d
|�d�|��}|jj|�}tj|�D]k}	tj|	j|	j|�
�}
|jj|
�}|j|�|	j|
��md|_y)N�rz"%s" rrz	(id="%s")zIndirect hyperlink target z refers to target "rz", �.��	base_noder4r5)rr�refnamesr7�refidsr9r:r;r�uniqrr<r=r>r?rB)r#r�explanation�naming�reflistr%r$rFrGrHrIrJs            r&r`z(IndirectHyperlinks.indirect_target_errorsk�������'�?��v�g��q�1�1�F��7�O�	A�D��N�N�4�=�=�1�1�5�5�d�B�?�@�	A���-�	=�B��N�N�4�=�=�/�/�3�3�B��;�<�	=��%�=��k�F�5�M�!�$4�4�4�F��m�m�$�$�*�*���	�*�K�9�DJ�+�L���
�
�$�$�S�)���:�:�g�&�	"�C��#�#��-�-����e�=�C��M�M�(�(��-�E��O�O�E�"����S�!�	"���r(c��|jd�rd}|jj}n|jd�rd}d}ny||}|dD]�}|jjj	|g�}|r|j|��|D]T}|jr�|d=|||<|r||�d|_t|tj�s�D|j|��V��|dD]�}|jjj	|g�}|r|j|��|D]T}|jr�|d=|||<|r||�d|_t|tj�s�D|j|��V��y)	Nr
rr�r%rr5rrT)rrr"rgr7rZrBrrrrQrh)	r#r�attname�call_method�attvalr%rlrHr$s	         r&rQz.IndirectHyperlinks.resolve_indirect_references#sz���>�>�'�"��G��-�-�2�2�K�
�^�^�H�
%��G��K�������7�O�
	:�D��m�m�,�,�0�0��r�:�G���)�)�t�)�4��	
:���<�<���	�N�%��G�����$� ����c�5�<�<�0��4�4�S�9�	
:�	
	:���-�
	:�B��m�m�*�*�.�.�r�2�6�G���)�)�R�)�0��	
:���<�<����L�%��G�����$� ����c�5�<�<�0��4�4�S�9�	
:�	
	:r(N)r*r+r,r-r.r'rPrYr[r`rQr/r(r&rLrL�s1��0�d��5�*�XG�K��.%:r(rLc��eZdZdZdZd�Zy)�ExternalTargetsa�
    Given::

        <paragraph>
            <reference refname="direct external">
                direct external
        <target id="id1" name="direct external" refuri="http://direct">

    The "refname" attribute is replaced by the direct "refuri" attribute::

        <paragraph>
            <reference refuri="http://direct">
                direct external
        <target id="id1" name="direct external" refuri="http://direct">
    i�c�\�|jjtj�D]�}|j	d�s�|d}|dD]_}|jj
j
|g�}|r|j|��|D]}|jr�|d=||d<d|_� �a��y)Nrrrnrr5)	rrrrrrgr7rZrB)r#rrr%rlrHs      r&r'zExternalTargets.apply_s����m�m�+�+�E�L�L�9�	)�F��~�~�h�'���)��"�7�O�	)�D�"�m�m�4�4�8�8��r�B�G���1�1�t�1�<�&�)���<�<�$��	�N�(.��H�
�'(���)�		)�	)r(Nr)r/r(r&rsrsKs��� ��
)r(rsc��eZdZdZd�Zd�Zy)�InternalTargetsi�c���|jjtj�D]7}|j	d�r�|j	d�r�'|j|��9y)Nrr
)rrrrr�resolve_reference_idsrRs  r&r'zInternalTargets.applyssI���m�m�+�+�E�L�L�9�	3�F��>�>�(�+�F�N�N�7�4K��*�*�6�2�	3r(c� �|dD]�}|jjj|�}|jjj|g�}|r|j	|��|D] }|j
r�|r|d=||d<d|_�"��y)a�
        Given::

            <paragraph>
                <reference refname="direct internal">
                    direct internal
            <target id="id1" name="direct internal">

        The "refname" attribute is replaced by "refid" linking to the target's
        "id"::

            <paragraph>
                <reference refid="id1">
                    direct internal
            <target id="id1" name="direct internal">
        rrnrr
r5N)rrVr7rgrZrB)r#rr%r
rlrHs      r&rxz%InternalTargets.resolve_reference_idsxs���"�7�O�	!�D��M�M�)�)�-�-�d�3�E��m�m�,�,�0�0��r�:�G���)�)�t�)�4��
!���<�<����I��#(�C��L� ���

!�	!r(N)r*r+r,r.r'rxr/r(r&rvrvos����3�
!r(rvc�F�eZdZdZdZdZ	gd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�	Footnotesa�
    Assign numbers to autonumbered footnotes, and resolve links to footnotes,
    citations, and their references.

    Given the following ``document`` as input::

        <document>
            <paragraph>
                A labeled autonumbered footnote reference:
                <footnote_reference auto="1" id="id1" refname="footnote">
            <paragraph>
                An unlabeled autonumbered footnote reference:
                <footnote_reference auto="1" id="id2">
            <footnote auto="1" id="id3">
                <paragraph>
                    Unlabeled autonumbered footnote.
            <footnote auto="1" id="footnote" name="footnote">
                <paragraph>
                    Labeled autonumbered footnote.

    Auto-numbered footnotes have attribute ``auto="1"`` and no label.
    Auto-numbered footnote_references have no reference text (they're
    empty elements). When resolving the numbering, a ``label`` element
    is added to the beginning of the ``footnote``, and reference text
    to the ``footnote_reference``.

    The transformed result will be::

        <document>
            <paragraph>
                A labeled autonumbered footnote reference:
                <footnote_reference auto="1" id="id1" refid="footnote">
                    2
            <paragraph>
                An unlabeled autonumbered footnote reference:
                <footnote_reference auto="1" id="id2" refid="id3">
                    1
            <footnote auto="1" id="id3" backrefs="id2">
                <label>
                    1
                <paragraph>
                    Unlabeled autonumbered footnote.
            <footnote auto="1" id="footnote" name="footnote" backrefs="id1">
                <label>
                    2
                <paragraph>
                    Labeled autonumbered footnote.

    Note that the footnotes are not in the same order as the references.

    The labels and reference text are added to the auto-numbered ``footnote``
    and ``footnote_reference`` elements.  Footnote elements are backlinked to
    their references via "refids" attributes.  References are assigned "id"
    and "refid" attributes.

    After adding labels and reference text, the "auto" attributes can be
    ignored.
    ilN)
�*u†u‡�§�¶�#u♠u♥u♦u♣c���g|_|jj}|j|�|j_|j	|�|j�|j
�yrN)�autofootnote_labelsr�autofootnote_start�number_footnotes�number_footnote_references�symbolize_footnotes�resolve_footnotes_and_citations)r#�startnums  r&r'zFootnotes.apply�sV��#%�� ��=�=�3�3��+/�+@�+@��+J��
�
�(��'�'��1�� � �"��,�,�.r(c�(�|jjD�]w}	t|�}|dz
}||jjvrn�*|j	dtjd|��|dD]�}|jjj|g�D]�}|tj|�z
}|jd�t|d�t|d�cxk(rdk(sJ�J�|dd|d<|j|dd�|jj|�d|_����|dr��&|dr��-|dj|�|jj!||�|j"j|���z|S)	z�
        Assign numbers to autonumbered footnotes.

        For labeled autonumbered footnotes, copy the number over to
        corresponding footnote references.
        r5rrcrrrr
�dupnames)r�
autofootnotes�strrV�insertr�label�
footnote_refsr7�Text�delattrrr>r"rBr8�note_explicit_targetr�)r#r��footnoter�r%rHs      r&r�zFootnotes.number_footnotes�s~���
�
�3�3�	7�H���H�
���A�
����
�
� 5� 5�5��	�

�O�O�A�u�{�{�2�u�5�6� ��)�
%���=�=�6�6�:�:�4��D�%�C��5�:�:�e�,�,�C��K�K�	�*��x���/�3�s�5�z�?�G�a�G�G�G�G�G�#+�E�?�1�#5�C��L��(�(��U��A��7��M�M�,�,�S�1�#$�C�L�%�
%��G�$�X�j�-A���!�(�(��/��
�
�2�2�8�X�F��(�(�/�/��6�'	7�(�r(c��d}|jjD]�}|js|jd�r�!	|j|}|tj|�z
}|jj |}	|jj"|	}
|	|d<|jj%|�t|d�d	k(sJ�|
j|dd�d	|_|d	z
}��y#t
$�r|jjjdt|j�z|��}|jj|�}|jj|dD]�}|js|jd�r�!tj|j|j|��}|jj|�}|j|�|j|���YywxYw)
z3Assign numbers to autonumbered footnote references.rr
zUToo many autonumbered footnote references: only %s corresponding footnotes available.reNrr4rr5)r�autofootnote_refsrBrr��
IndexErrorr9r:rr;rr<r=r>r?r�rVrr")r#r��irHr�rFrGrIrJr$r�s           r&r�z$Footnotes.number_footnote_referencess���
���=�=�2�2�	�C��|�|�s�{�{�7�3��
��0�0��3�� 
�5�:�:�e�$�$�C����&�&�u�-�B��}�}�(�(��,�H��C��L��M�M�$�$�S�)��s�5�z�?�a�'�'�'�� � ��U��A��/��C�L�
��F�A�9	��
�
��m�m�,�,�2�2�;��D�4�4�5�6�AD�3�F���
�
�,�,�S�1���=�=�:�:�1�2�>�*�C��|�|�s�{�{�9�'=� ��+�+��-�-����e�E�C� �M�M�0�0��5�E��O�O�E�*��$�$�S�)�*��
�s�C-�-DG8�7G8c�
�g}|jjD]�}t|jjt	|j
��\}}|j
||dzz}|j
|�|jdtjd|��|jxjdz
c_|jj|���d}|jjD]�}	|tj||�z
}|jj|}t	|d	�dk(sJ�|d	d|d<|jj-|�|j)|d	d�|dz
}��y#t$r�|jjjdt	|�z|��}|jj|�}	|jj|dD]�}|j s|j#d�r�!tj$|j&|j&|	��}
|jj|
�}|j)|�|j+|
���YywxYw)
z<Add symbols indexes to "[*]"-style footnotes and references.r5rrczOToo many symbol footnote references: only %s corresponding footnotes available.reNr
r4r)r�symbol_footnotes�divmod�symbol_footnote_startr�symbolsr8r�rr�r;�symbol_footnote_refsr�r�r9r:rBrr<r=r>r?r")r#�labelsr��reps�index�	labeltextr�rHrFrGrIrJs            r&r�zFootnotes.symbolize_footnotes0s8�����
�
�6�6�	+�H� ����!D�!D�!$�T�\�\�!2�4�K�D�%����U�+�t�a�x�8�I��M�M�)�$��O�O�A�u�{�{�2�y�9�:��M�M�/�/�1�4�/��M�M� � ��*�	+�
���=�=�5�5�	�C�
��u�z�z�&��)�,�,�� �}�}�5�5�a�8�H��x���'�1�,�,�,�#�E�?�1�-�C��L��M�M�$�$�S�)�� � ��U��A��/�
��F�A�/	���
��m�m�,�,�2�2�;�=@��[�I� #�3�%���
�
�,�,�S�1���=�=�=�=�a�b�A�*�C��|�|�s�{�{�7�';� ��+�+��-�-����e�E�C� �M�M�0�0��5�E��O�O�E�*��$�$�S�)�*��
�s�6F�C<J�Jc��|jjD]P}|dD]F}||jjvs�|jj|}|j||��H�R|jjD]P}|dD]F}||jj
vs�|jj
|}|j||��H�Ry)za
        Link manually-labeled footnotes and citations to/from their
        references.
        rN)r�	footnotesr��resolve_references�	citations�
citation_refs)r#r�r�rl�citations     r&r�z)Footnotes.resolve_footnotes_and_citationsUs���
�
�
�/�/�	?�H�!�'�*�
?���D�M�M�7�7�7�"�m�m�9�9�%�@�G��+�+�H�g�>�
?�	?�
�
�
�/�/�	?�H�!�'�*�
?���D�M�M�7�7�7�"�m�m�9�9�%�@�G��+�+�H�g�>�
?�	?r(c��t|d�dk(sJ�|dd}|D]V}|jr�|jd�||d<t|d�dk(sJ�|j|dd�d|_�Xd|_y)Nrr5rrr
)rrBr�r>)r#�noterlr$rHs     r&r�zFootnotes.resolve_referenceses����4��;��1�$�$�$�
�%�[��^���	�C��|�|���K�K�	�"��C��L��s�5�z�?�a�'�'�'����S��Z��]�+��C�L�	���
r()
r*r+r,r-r.r�r�r'r�r�r�r�r�r/r(r&r{r{�s@��9�v����9��G�"/��:�B#�J?� r(r{c��eZdZy)�#CircularSubstitutionDefinitionErrorN)r*r+r,r/r(r&r�r�ss��r(r�c��eZdZdZdZ	d�Zy)�
SubstitutionsaD
    Given the following ``document`` as input::

        <document>
            <paragraph>
                The
                <substitution_reference refname="biohazard">
                    biohazard
                 symbol is deservedly scary-looking.
            <substitution_definition name="biohazard">
                <image alt="biohazard" uri="biohazard.png">

    The ``substitution_reference`` will simply be replaced by the
    contents of the corresponding ``substitution_definition``.

    The transformed result will be::

        <document>
            <paragraph>
                The
                <image alt="biohazard" uri="biohazard.png">
                 symbol is deservedly scary-looking.
            <substitution_definition name="biohazard">
                <image alt="biohazard" uri="biohazard.png">
    ��c	� 
�|jj}|jj}i}t|jjdd�}t|jj
tj��}|D�]}d}|d}||vr|}	n"|j�}
|j|
d�}	|	�+|jjjd|z|��}nI||	}t|j��|kDr(|jjjd|	z�}|r�|jj|�}tj |j"|j"|��}
|jj|
�}|j%|�|j'|
���2|j(}|j+|�}d	j,vsd
|j,vrA|dkDr<t/||dz
tj0�r||dz
j3�||dz
<d
|j,vsd
|j,vrMt|�|dzkDr<t/||dztj0�r||dzj5�||dz<|j7�}	|j
tj�D]\}||dj�}||j9|g�vrt:�||j=|	�||d<|j=|��^	|j'|jF�|jFD]=}t/|tjH�s�d|vs�#|jjK|��?��y#t:$�ro|j(}t/|tj>�rm|jjjdtj@|j"|j"�|jB|��}|j'|�n�|}|jEd�r|d}|jEd�r�|jjjd|z|��}|jj|�}tj |j"|j"|��}
|jj|
�}|j%|�|j'|
�Y���wxYw)N�line_length_limiti'rcrz(Undefined substitution referenced: "%s".rez;Substitution definition "%s" exceeds the line-length-limit.r4�ltrim�trimrr5�rtrimz
ref-originz*Circular substitution definition detected:)�linerfz2Circular substitution definition referenced: "%s".)&r�substitution_defs�substitution_namesr!�settings�listrr�substitution_reference�lowerr7r9r:r�astextr;r<r=r>r?rr��
attributesrr��rstrip�lstrip�deepcopy�
setdefaultr�r8�substitution_definition�
literal_blockr�r�children�Referential�note_refname)r#�defs�normed�nestedr��
subreflistrHrFr�key�normed_name�subdefrGrIrJrr��subdef_copy�
nested_ref�nested_name�
ref_originrEs                      r&r'zSubstitutions.apply�s����}�}�.�.�����1�1����#�D�M�M�$:�$:�$7��@���$�-�-�/�/��0L�0L�M�N�
��R	9�C��C��)�n�G��$����%�m�m�o���j�j��d�3���{��m�m�,�,�2�2�@�� �+.�3�0���c����v�}�}��'�*;�;��-�-�0�0�6�6�2�47�8�9�C���
�
�,�,�S�1���'�'��m�m�S�]�]�%�A���
�
�,�,�S�1������&�� � ��%���Z�Z�F��L�L��%�E��6�,�,�,��V�.�.�.��1�9��F�5�1�9�,=�,1�J�J�"8�(.�u�q�y�(9�(@�(@�(B�F�5�1�9�%��6�,�,�,��V�.�.�.���K�%�!�)�+�"�6�%�!�)�#4�e�j�j�A�(.�u�q�y�(9�(@�(@�(B�F�5�1�9�%� �/�/�+�K�!
�"-�"5�"5��4�4�#6�2�J�"(��I�)>�)D�)D�)F�"G�K�"�f�&7�&7��R�&H�H�A�A��;�'�.�.�s�3�/2�J�|�,��%�%�j�1�2�@
���[�1�1�2�$�,�,�
9���d�E�$5�$5�6�!�D�(��
�
�2�2�4�8�
9�[R	9��d7�
������f�e�&C�&C�D��-�-�0�0�6�6�D��+�+�F�,<�,<�,2�,<�,<�>�#�[�[�F�	7�<�C�
�'�'��,�"%�J�$�,�,�\�:�%/��%=�
�%�,�,�\�:��-�-�0�0�6�6� �")�*�5?�7�A�C�!�M�M�0�0��5�E��+�+��
�
�s�}�}�E�C�C� �M�M�0�0��5�E��O�O�E�*��$�$�S�)��/
�s�*A>N�CT
�B.T
�T
Nr)r/r(r&r�r�ws���4��>�Z9r(r�c�(�eZdZdZdZ	d�Zd�Zd�Zy)�TargetNotesz�
    Creates a footnote for each external target in the text, and corresponding
    footnote references after each reference.
    ic�v�tj|||��|jjdg�|_y)N)�	startnode�class)r�__init__�detailsr7�classes)r#rr�s   r&r�zTargetNotes.__init__�s.�����4��Y�?� �(�(�,�,�W�b�9��r(c���i}g}|jjtj�D]�}|j	d�s�|d}g}|D]7}|j|jjj|g���9|s�[|j|d||�}|d|vs�y|||d<|j|���|jjtj�D]^}|jd�s�|j	d�s�'|j|d|g|�}|d|vs�F|||d<|j|��`|jj|�y)Nrrr3)
rrrrrrrgr7�make_target_footnoter8r6r�r?)	r#�notes�nodelistrr�refsr%r�rHs	         r&r'zTargetNotes.applys_�������m�m�+�+�E�L�L�9�	*�F��>�>�(�+���7�O�E��D��
B�����D�M�M�2�2�6�6�t�R�@�A�
B����0�0���1A�4�16�8�H��h��u�,�*2��f�X�&�'�����)�	*� �=�=�(�(����9�	.�C��7�7�;�'���{�{�8�$��4�4�S��]�S�E�5:�<���x�=��-�+3�E�#�h�-�(��O�O�H�-�	.�	
���#�#�H�-r(c�F�||vr!||}t|d�dk(sJ�|dd}n�tj�}|jj	|�}d|z}d|d<|g|d<tj
�}|tjd||��z
}||z
}|jj|�|jj||�|D�]K}t|tj�r�tj|d��}	|	d	xx|jz
cc<|jj|	�|jj|	�|jj!|�dz}
|	g}t#j$|jj&�sc|jr2|j)dtj*d
|j���n%|j)dtj,d
��|jj)|
|���N|S)Nrr5rz
TARGET_NOTE: �autorc)r)rr�r�� )�text�Classes)rrr�rr;�	paragraphr6�note_autofootnoter�rr�footnote_referencer��note_autofootnote_ref�note_footnote_refrr�r�get_trim_footnote_ref_spacer�r��inliner�)r#rr�r�r��
footnote_name�footnote_id�footnote_paragraphrH�refnoder�rls            r&r�z TargetNotes.make_target_footnote"s����U�?��V�}�H��x��(�)�Q�.�.�.�$�W�-�a�0�M��~�~�'�H��-�-�.�.�x�8�K�,�k�9�M� �H�V��!.��H�W��!&���!2���%�/�/�"�f�V�"L�L���*�*�H��M�M�+�+�H�5��M�M�.�.�x��B��	.�C��#�u�|�|�,���.�.�}�1�M�G��I��$�,�,�.���M�M�/�/��8��M�M�+�+�G�4��J�J�$�$�S�)�A�-�E��i�G��4�4�T�]�]�5K�5K�L��<�<��N�N��5�<�<�S�$�,�,�G�I��N�N�1�e�j�j��o�6��J�J���e�W�-�	.� �r(N)r*r+r,r-r.r�r'r�r/r(r&r�r��s#���
���:�
.�<"r(r�c��eZdZdZdZd�Zy)�DanglingReferencesze
    Check for dangling references (incl. footnote & citation) and for
    unreferenced targets.
    iRc���t|j|jjj�}|jj	|�|jjtj�D]l}|jr�|jd�r�"|dr	|dd}n|dr	|dd}n|d}|jjjd|z|���ny)Nr3rrrr
z(Hyperlink target "%s" is not referenced.re)�DanglingReferencesVisitorrrWrX�walkrrrrAr7r9�info)r#�visitorrrks    r&r'zDanglingReferences.applyPs���+��M�M��M�M�%�%�A�A�C��	
�
�
���7�#��m�m�+�+�E�L�L�9�	0�F��$�$��:�:�k�*�
��'�?�#�G�_�Q�/�F��E�]�#�E�]�1�-�F�$�G�_�F��
�
�&�&�+�+�>���(.�,�0�!	0r(Nr)r/r(r&r�r�Gs���
��0r(r�c�&�eZdZd�Zd�Zd�ZexZZy)r�c�`�tjj||�||_||_yrN)r�SparseNodeVisitorr�rrX)r#rrXs   r&r�z"DanglingReferencesVisitor.__init__ns'��
���(�(��x�8� ��
�+F��(r(c��yrNr/)r#rEs  r&�
unknown_visitz'DanglingReferencesVisitor.unknown_visitss��r(c���|js|jd�sy|d}|jjj	|�}|��E|j
D]}||�s�yt
|jjdd�r"t|tj�rd|_y||jjvr.|jjjd|dz|��}n.|jjjd|d�d�|��}|jj|�}tj|j|j|�	�}	|d
d}|j#|�|j%|�y|d=||d<|jj&|j)|�
�d|_y#t $r|jj|�}Y��wxYw)Nr�
use_bibtexFTzBDuplicate target name, cannot be used as a unique reference: "%s".rezUnknown target name: "z".r4rrr
rT)rBrrrVr7rXr!r�rr�citation_referencer9r:r;r<r=r�r>r?rrZ)	r#rErr$r]rFrGrIrJs	         r&�visit_referencez)DanglingReferencesVisitor.visit_referencevs����=�=����Y� 7���y�/��
�]�]�
"�
"�
&�
&�w�
/��
�:�%)�%E�%E�
'�!�$�T�*��
'��D�M�M�2�2�L�%�H�"�4��)A�)A�B�$(�D�M���d�m�m�3�3�3��-�-�0�0�6�6�+�.2�9�o�?�JN�7�P�C��-�-�0�0�6�6�0��i��0A��D�"&�7�(�C��
�
�,�,�S�1���'�'��n�n�d�n�n�E�C��6� ��K��N�E�����&��!�!�#�&��Y���D��M��M�M���b�!�4�4��4�;� �D�M��"�6� �M�M�0�0��5�E�6�s�&G
�
$G1�0G1N)r*r+r,r�r�r��visit_footnote_reference�visit_citation_referencer/r(r&r�r�ls"��G�

�$!�L;J�I��7r(r�N)r-�
__docformat__�docutilsrr�docutils.transformsrrr1rLrsrvr{�	Exceptionr�r�r�r�r�r�r/r(r&�<module>rs���
�#�
�!�)�G-�y�G-�T>�)�>�Bn:��n:�b!)�i�!)�H%!�i�%!�PY�	�Y�x	�)�	�z9�I�z9�zP�)�P�f"0��"0�J0J�� 7� 7�0Jr(