Hacked By AnonymousFox

Current Path : /opt/imunify360/venv/lib/python3.11/site-packages/docutils/transforms/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib/python3.11/site-packages/docutils/transforms/__pycache__/frontmatter.cpython-311.pyc

�

j��f{S���dZdZddlZddlmZmZmZddlmZm	Z	Gd�de	��Z
Gd�d	e
��ZGd
�de
��ZGd�d
e	��Z
dS)a4
Transforms related to the front matter of a document or a section
(information found before the main text):

- `DocTitle`: Used to transform a lone top level section's title to
  the document title, promote a remaining lone top-level section's
  title to the document subtitle, and determine the document's title
  metadata (document['title']) based on the document title and/or the
  "title" setting.

- `SectionSubTitle`: Used to transform a lone subsection into a
  subtitle.

- `DocInfo`: Used to transform a bibliographic field list into docinfo
  elements.
�reStructuredText�N)�nodes�parsers�utils)�TransformError�	Transformc�$�eZdZdZd�Zd�Zd�ZdS)�
TitlePromoterzJ
    Abstract base class for DocTitle and SectionSubTitle transforms.
    c��t|tj��std���t	|��r"t|dtj��rJ�|�|��\}}|�dS|�|dd���|dd�|d|�z|dd�z|dd�<t|dtj��sJ�dS)a
        Transform the following tree::

            <node>
                <section>
                    <title>
                    ...

        into ::

            <node>
                <title>
                ...

        `node` is normally a document.
        �%node must be of Element-derived type.rNFT��replace�
and_source�)�
isinstancer�Element�	TypeError�len�title�candidate_index�update_all_atts_concatenating)�self�node�section�indexs    �/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/docutils/transforms/frontmatter.py�
promote_titlezTitlePromoter.promote_title$s���$�$��
�.�.�	E��C�D�D�D���I�I�C�*�T�!�W�e�k�"B�"B�C�C�C��-�-�d�3�3�����=��5�	
�*�*�7�D�6:�	+�	<�	<�	<��2�A�2�;��&�5�&�\�"��Q�R�R�[�!��Q�Q�Q���$�q�'�5�;�/�/�/�/�/��t�c�b�t|tj��std���|�|��\}}|�dStj��}|�|dd���|ddd�|dd�<|dd�|gz|d|�z|dd�z|dd�<dS)a
        Transform the following node tree::

            <node>
                <title>
                <section>
                    <title>
                    ...

        into ::

            <node>
                <title>
                <subtitle>
                ...
        rNFTr
rr)rrrrr�subtitler)rr�
subsectionrr s     r�promote_subtitlezTitlePromoter.promote_subtitleOs���$�$��
�.�.�	E��C�D�D�D� �0�0��6�6��
�E��=��5��>�#�#��	�.�.�z�4�:>�	/�	@�	@�	@�
!��m�A�A�A�&����������8��Z� ��!�E�'�]�#�
 ����^�$��Q�Q�Q���trc���|�tj��}|�6t|��|dzks t	||tj��sdS|||fS)z�
        Find and return the promotion candidate and its index.

        Return (None, None) if no valid candidate was found.
        Nr)NN)�first_child_not_matching_classr�PreBibliographicrrr)rrrs   rrzTitlePromoter.candidate_index|sd���3�3��"�$�$���M�S��Y�Y�%�!�)�4�4��d�5�k�5�=�9�9�5��:���;��%�%rN)�__name__�
__module__�__qualname__�__doc__rr"r�rrr
r
sM��������)�)�)�V+�+�+�Z&�&�&�&�&rr
c�"�eZdZdZdZd�Zd�ZdS)�DocTitlea�

    In reStructuredText_, there is no way to specify a document title
    and subtitle explicitly. Instead, we can supply the document title
    (and possibly the subtitle as well) implicitly, and use this
    two-step transform to "raise" or "promote" the title(s) (and their
    corresponding section contents) to the document level.

    1. If the document contains a single top-level section as its
       first non-comment element, the top-level section's title
       becomes the document's title, and the top-level section's
       contents become the document's immediate contents. The lone
       top-level section header must be the first non-comment element
       in the document.

       For example, take this input text::

           =================
            Top-Level Title
           =================

           A paragraph.

       Once parsed, it looks like this::

           <document>
               <section names="top-level title">
                   <title>
                       Top-Level Title
                   <paragraph>
                       A paragraph.

       After running the DocTitle transform, we have::

           <document names="top-level title">
               <title>
                   Top-Level Title
               <paragraph>
                   A paragraph.

    2. If step 1 successfully determines the document title, we
       continue by checking for a subtitle.

       If the lone top-level section itself contains a single
       second-level section as its first non-comment element, that
       section's title is promoted to the document's subtitle, and
       that section's contents become the document's immediate
       contents. Given this input text::

           =================
            Top-Level Title
           =================

           Second-Level Title
           ~~~~~~~~~~~~~~~~~~

           A paragraph.

       After parsing and running the Section Promotion transform, the
       result is::

           <document names="top-level title">
               <title>
                   Top-Level Title
               <subtitle names="second-level title">
                   Second-Level Title
               <paragraph>
                   A paragraph.

       (Note that the implicit hyperlink target generated by the
       "Second-Level Title" is preserved on the "subtitle" element
       itself.)

    Any comment elements occurring before the document title or
    subtitle are accumulated and inserted as the first body elements
    after the title(s).

    This transform also sets the document's metadata title
    (document['title']).

    .. _reStructuredText: https://docutils.sourceforge.io/rst.html
    i@c�^�|j�d��s�|jjj�|jjj|jd<dSt	|j��rPt|jdtj��r-|jd���|jd<dSdSdSdS)a
        Set document['title'] metadata title from the following
        sources, listed in order of priority:

        * Existing document['title'] attribute.
        * "title" setting.
        * Document title node (as promoted by promote_title).
        rNr)�document�hasattr�settingsrrrr�astext�rs r�set_metadatazDocTitle.set_metadata�s����}�$�$�W�-�-�	C��}�%�+�7�)-��)?�)E��
�g�&�&�&��T�]�#�#�
C�
�4�=��3C�38�;�)@�)@�
C�)-��q�)9�)@�)@�)B�)B��
�g�&�&�&�	C�	C�
C�
C�
C�
Crc���|jj�dd��r4|�|j��r|�|j��|���dS)N�doctitle_xformT)r.r0�
setdefaultrr"r3r2s r�applyzDocTitle.apply�sh���=�!�,�,�-=�t�D�D�	5��!�!�$�-�0�0�
5��%�%�d�m�4�4�4��������rN)r&r'r(r)�default_priorityr3r7r*rrr,r,�sJ������P�P�d��C�C�C� ����rr,c��eZdZdZdZd�ZdS)�SectionSubTitlea�
    This works like document subtitles, but for sections.  For example, ::

        <section>
            <title>
                Title
            <section>
                <title>
                    Subtitle
                ...

    is transformed into ::

        <section>
            <title>
                Title
            <subtitle>
                Subtitle
            ...

    For details refer to the docstring of DocTitle.
    i^c���|jj�dd��sdS|j�tj��D]}|�|���dS)N�sectsubtitle_xformT)r.r0r6�findallrrr")rrs  rr7zSectionSubTitle.applysi���}�%�0�0�1E�t�L�L�	��F��}�,�,�U�]�;�;�	+�	+�G�
�!�!�'�*�*�*�*�		+�	+rN)r&r'r(r)r8r7r*rrr:r:�s5��������.��+�+�+�+�+rr:c
�`�eZdZdZdZejejejej	ej
ejejej
ejejejejd�Z	d�Zd�Zd�Zd�Zejdej��d	fejd
ej��dfejd��dfgZd
�Zd�Zd�Zd�ZdS)�DocInfoaf
    This transform is specific to the reStructuredText_ markup syntax;
    see "Bibliographic Fields" in the `reStructuredText Markup
    Specification`_ for a high-level description. This transform
    should be run *after* the `DocTitle` transform.

    Given a field list as the first non-comment element after the
    document title and subtitle (if present), registered bibliographic
    field names are transformed to the corresponding DTD elements,
    becoming child elements of the "docinfo" element (except for a
    dedication and/or an abstract, which become "topic" elements after
    "docinfo").

    For example, given this document fragment after parsing::

        <document>
            <title>
                Document Title
            <field_list>
                <field>
                    <field_name>
                        Author
                    <field_body>
                        <paragraph>
                            A. Name
                <field>
                    <field_name>
                        Status
                    <field_body>
                        <paragraph>
                            $RCSfile$
            ...

    After running the bibliographic field list transform, the
    resulting document tree would look like this::

        <document>
            <title>
                Document Title
            <docinfo>
                <author>
                    A. Name
                <status>
                    frontmatter.py
            ...

    The "Status" field contained an expanded RCS keyword, which is
    normally (but optionally) cleaned up by the transform. The sole
    contents of the field body must be a paragraph containing an
    expanded RCS keyword of the form "$keyword: expansion text $". Any
    RCS keyword can be processed in any bibliographic field. The
    dollar signs and leading RCS keyword name are removed. Extra
    processing is done for the following RCS keywords:

    - "RCSfile" expands to the name of the file in the RCS or CVS
      repository, which is the name of the source file with a ",v"
      suffix appended. The transform will remove the ",v" suffix.

    - "Date" expands to the format "YYYY/MM/DD hh:mm:ss" (in the UTC
      time zone). The RCS Keywords transform will extract just the
      date itself and transform it to an ISO 8601 format date, as in
      "2000-12-31".

      (Since the source file for this text is itself stored under CVS,
      we can't show an example of the "Date" RCS keyword because we
      can't prevent any RCS keywords used in this explanation from
      being expanded. Only the "RCSfile" keyword is stable; its
      expansion text changes only if the file name changes.)

    .. _reStructuredText: https://docutils.sourceforge.io/rst.html
    .. _reStructuredText Markup Specification:
       https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html
    iT)�author�authors�organization�address�contact�version�revision�status�date�	copyright�
dedication�abstractc��|jj�dd��sdS|j}|�tj��}|�dS||}t
|tj��rW|�tjtj	tj
f��}|�|��}||=||||�<dSdS)N�
docinfo_xformT)r.r0r6r$rr%r�
field_list�Titular�
Decorative�meta�extract_bibliographic)rr.r�	candidate�biblioindex�nodelists      rr7z
DocInfo.applys����}�%�0�0��$�G�G�	��F��=���7�7��$�&�&���=��F��U�O�	��i��!1�2�2�	9�"�A�A��=�%�"2�E�J�?�A�A�K��1�1�)�<�<�H����08�H�[��,�-�-�-�	9�	9rc��tj��}|jj}|jj}ddd�}|D�]�}	|dd���}tj|��}t|��dkr||vr|�||��st�||}	|j
|	}
t|
tj��rm|�
||��st�tj|dd|j��|�|
ddg|dd�R���n�t|
tj��r|�|||��n�t|
tj��r�||	r9|dxx|jj�d|z|���z
cc<t�tj|||	��}||	|d_|
d|g|dj�Rd	|	gi�||	<n'|�|
dg|dj�R�����	#t$r�t|d��dkrLt7|ddtj��r&tj|dd|j��tj|��}|r|d	�|��|�|��Y���wxYwg}
t|��dkr|
�|��dD]%}||r|
�||���&|
S)
N)rJrKr�r����z!There can only be one "%s" field.��	base_node�classes)r�docinfo�language�bibliographic_fields�labelsr1�fully_normalize_namer�check_empty_biblio_fieldr�biblio_nodes�
issubclass�TextElement�check_compound_biblio_fieldr�clean_rcs_keywords�rcs_keyword_substitutions�appendrA�extract_authors�topicr.�reporter�warningr�	rawsource�childrenr�	paragraph�make_id)rrNr]�bibliofieldsr`�topics�field�name�
normedname�	canonical�biblioclassr�
classvaluerUs              rrRzDocInfo.extract_bibliographic�s����-�/�/���}�9����%�� $�$�7�7���&	&�&	&�E�%
&��Q�x��{�)�)�+�+��"�7��=�=�
��E�
�
�a���J�,�,F�,F� �9�9�%��F�F�-G�(�(�(��4�	�"�/�	�:���k�5�+<�=�=�H��;�;�E�4�H�H�-�,�,��,���(�1�+�t�'E�G�G�G��N�N�;�;�r�2�#D��a����#D�#D�#D�E�E�E�E���U�]�;�;�
H��(�(���g�>�>�>�>���U�[�9�9�H��i�(�-��b�	�	�	�T�]�%;�%C�%C�?�$�F�&+�&D�&-�&-�-�	�	�	�-�,�!�K��f�Y�.?�@�@�E�)/�	�):�E�!�H�&�(3���E�)L�9>�q��9J�)L�)L�)L�,5�;�)L�)L�F�9�%�%��N�N�;�;�r�#F�E�!�H�4E�#F�#F�#F�G�G�G���!�	
&�	
&�	
&��u�R�y�>�>�Q�&�&�%�e�B�i��l�E�O�D�D�'��,��b�	�!��d�&D�F�F�F�#�]�:�6�6�
��8��)�$�+�+�J�7�7�7����u�%�%�%�%�%�	
&�������w�<�<�1����O�O�G�$�$�$�.�	.�	.�D��d�|�
.�����t��-�-�-���s�HH<�<B5K5�4K5c��t|d��dkr5|dxx|jj�d|�d�|���z
cc<dSdS)NrYrz*Cannot extract empty bibliographic field "z".rZFT)rr.rlrm)rrtrus   rrbz DocInfo.check_empty_biblio_field�sf���u�R�y�>�>�A����"�I�I�I���/�7�7�G�t�G�G�G�!�8�#�#�
#�I�I�I��5��trc�.�|d}t|��dkr"t|dtj��rdSt|dtj��r�d|j���vr�tjd|j	j
��}tj�
��}|�d|jz|��t|j��dkr3t|jdtj��r|j|_dSd�|jD��}t|��dkrd	d
�|��zdz}nd|dz}||j	j�d
|�d|�d�|���z
}dS)NrYrrT�
z*DocInfo transform*�\c�$�g|]
}d|j�d���S)�<�>)�tagname)�.0�es  r�
<listcomp>z7DocInfo.check_compound_biblio_field.<locals>.<listcomp>�s&��=�=�=��#�q�y�#�#�#�=�=�=r�[z, �]za zBibliographic field "z)"
must contain a single <paragraph>, not �.rZF)rrrrp�enumerated_listrn�stripr�new_documentr.r0r�rst�Parser�parsero�joinrlrm)rrtru�f_body�	_document�parser�contents       rrfz#DocInfo.check_compound_biblio_field�s����r����v�;�;�!���
�6�!�9�e�o� F� F���4�
�v�a�y�%�"7�8�8�
	��F�,�2�2�4�4�4�4��*�+@�+0�>�+B�D�D�I��[�'�'�)�)�F��L�L��f�.�.�	�:�:�:��I�&�'�'�1�,�,��y�1�!�4�e�o�F�F�-�"+�"4����t�=�=�V�_�=�=�=���w�<�<�!����D�I�I�g�.�.�.��4�G�G��W�Q�Z�'�G��$�-�(�0�0�>�d�>�>�3:�>�>�>� %�1�'�'�	'���urz8\$Date: (\d\d\d\d)[-/](\d\d)[-/](\d\d)[ T][\d:]+[^$]* \$z\1-\2-\3z\$RCSfile: (.+),v \$z\1z\$[a-zA-Z]+: (.+) \$c���	t|d��dkrt|ddtj��r|�|��}nXt|ddtj��r|�|��}nt�|�|��}d�|D��}t|��dkr'|�	tj
dg|�R���dSt�#t$rX|dxx|jj�
d|�d|�dd�|jj���d	�|�
��z
cc<�wxYw)Nrrc�8�g|]}|�tjddg|�R���S)rX)rr@)r�r@s  rr�z+DocInfo.extract_authors.<locals>.<listcomp>�s@��<�<�<�%�F�<�5�<��B�8��8�8�8�<�<�<rrXrYzCannot extract "z1" from bibliographic field:
Bibliographic field "zR" must contain either
 a single paragraph (with author names separated by one of "z�"),
 multiple paragraphs (one per author),
 or a bullet list with one author name per item.
Note: Leading initials can cause (mis)recognizing names as enumerated list.rZ)rrrrp�authors_from_one_paragraph�bullet_list�authors_from_bullet_listr�authors_from_paragraphsrirAr.rlrmr�r^�author_separators)rrtrur]rA�authornodess      rrjzDocInfo.extract_authors�s���	��5��8�}�}��!�!��e�A�h�q�k�5�?�;�;�)�"�=�=�e�D�D�G�G���a����U�->�?�?�)�"�;�;�E�B�B�G�G�(�(��6�6�u�=�=��<�<�)0�<�<�<�K��;���1�$�$����u�}�R�>�+�>�>�>�?�?�?�?�?�$�$���	�	�	��"�I�I�I���/�7�7�&�4�&�&�(,�&�&��G�G�D�M�;�<�<�&�&�&� �8�	!�	!�	
!�I�I�I�
�	���s�C1C<�5C<�<A"Ec�D�d�d�|d�tj��D����}|st�|jjD]1}d|z}tj||��}t|��dkrn�2d�|D��}d�|D��S)z�Return list of Text nodes with author names in `field`.

        Author names must be separated by one of the "autor separators"
        defined for the document language (default: ";" or ",").
        rXc3�4K�|]}t|��V��dS�N)�str)r�rs  r�	<genexpr>z5DocInfo.authors_from_one_paragraph.<locals>.<genexpr>sD����A�A���4�y�y�A�A�A�A�A�Arrz(?<!)%sc3�>K�|]}|���V��dSr�)r��r�rus  rr�z5DocInfo.authors_from_one_paragraph.<locals>.<genexpr> s*����<�<��t�z�z�|�|�<�<�<�<�<�<rc�<�g|]}|�tj|��g��Sr*)r�Textr�s  rr�z6DocInfo.authors_from_one_paragraph.<locals>.<listcomp>!s*��C�C�C�t�d�C���D�!�!�"�C�C�Cr)
r�r=rr�rr^r��re�splitr)rrt�text�	authorsep�pattern�authornamess      rr�z"DocInfo.authors_from_one_paragraphs����w�w�A�A�#(��8�#3�#3�E�J�#?�#?�A�A�A�A�A���	!� � ���8�	�	�I�#�i�/�G��(�7�D�1�1�K��;���!�#�#���$�<�<��<�<�<��C�C�{�C�C�C�Crc�(�g}|ddD]w}t|tj��r�t|��dks t|dtj��st
�|�|dj���x|st
�|S)Nrr)rr�commentrrprriro)rrtrA�items    rr�z DocInfo.authors_from_bullet_list#s������!�H�Q�K�	-�	-�D��$��
�.�.�
���4�y�y�A�~�~�Z��Q����%I�%I�~�$�$��N�N�4��7�+�,�,�,�,��	!� � ��rc��|dD]/}t|tjtjf��st��0d�|dD��}|S)Nrc�P�g|]#}t|tj���|j��$Sr*)rrr�ro)r�r�s  rr�z3DocInfo.authors_from_paragraphs.<locals>.<listcomp>3s:��;�;�;�T�$�T�5�=�9�9�;�4�=�;�;�;r)rrrpr�r)rrtr�rAs    rr�zDocInfo.authors_from_paragraphs/sa���!�H�	%�	%�D��d�U�_�e�m�$D�E�E�
%�$�$�
%�;�;�U�1�X�;�;�;���rN)r&r'r(r)r8rr@rArBrCrDrErFrGrHrIrkrcr7rRrbrfr��compile�
IGNORECASErhrjr�r�r�r*rrr?r?!sR������H�H�T���L��]��,��]��]��]��n��L��*������k�#�#�L�*�9�9�9� 2�2�2�h������B�2�:�"�#%�=�2�2�3>�@��2�:�1�2�=�A�A�5�
I��2�:�-�.�.��
6�	!8�����<D�D�D�(
�
�
�����rr?)r)�
__docformat__r��docutilsrrr�docutils.transformsrrr
r,r:r?r*rr�<module>r�s$��
��"#�
�	�	�	�	�*�*�*�*�*�*�*�*�*�*�9�9�9�9�9�9�9�9�j&�j&�j&�j&�j&�I�j&�j&�j&�Zn�n�n�n�n�}�n�n�n�b"+�"+�"+�"+�"+�m�"+�"+�"+�JT�T�T�T�T�i�T�T�T�T�Tr

Hacked By AnonymousFox1.0, Coded By AnonymousFox