Hacked By AnonymousFox

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

�

i��f���H�dZdZddlZddlmZmZddlmZmZm	Z	ddlm
Z
mZddlm
Z
mZddlmZdd	lmZmZddlZdd
lmZmZmZmZddlmZmZddlmZmZmZdd
lmZGd�de��Z Gd�de��Z!Gd�de��Z"Gd�de
��Z#Gd�de$��Z%Gd�d��Z&Gd�de
��Z'Gd�de
��Z(Gd�de��Z)dNd!�Z*Gd"�d#��Z+e,d$��d%z
fd&�Z-e,d'��d%z
fd(�Z.d)�Z/Gd*�d+e)��Z0Gd,�d-e0��Z1Gd.�d/e0��Z2Gd0�d1e2��Z3Gd2�d3e2��Z4Gd4�d5e2��Z5Gd6�d7e2��Z6Gd8�d9e2��Z7Gd:�d;e2e1��Z8Gd<�d=e6��Z9Gd>�d?e2��Z:Gd@�dAe2��Z;GdB�dCe0��Z<GdD�dEe)��Z=GdF�dGe=��Z>GdH�dIe>��Z?GdJ�dKe>��Z@GdL�dMe)��ZAe0e3e4e5e6e7e:e9e;e=e?e@e<e1e8fZBdS)Oa�
This is the ``docutils.parsers.rst.states`` module, the core of
the reStructuredText parser.  It defines the following:

:Classes:
    - `RSTStateMachine`: reStructuredText parser's entry point.
    - `NestedStateMachine`: recursive StateMachine.
    - `RSTState`: reStructuredText State superclass.
    - `Inliner`: For parsing inline markup.
    - `Body`: Generic classifier of the first line of a block.
    - `SpecializedBody`: Superclass for compound element members.
    - `BulletList`: Second and subsequent bullet_list list_items
    - `DefinitionList`: Second+ definition_list_items.
    - `EnumeratedList`: Second+ enumerated_list list_items.
    - `FieldList`: Second+ fields.
    - `OptionList`: Second+ option_list_items.
    - `RFC2822List`: Second+ RFC2822-style fields.
    - `ExtensionOptions`: Parses directive option fields.
    - `Explicit`: Second+ explicit markup constructs.
    - `SubstitutionDef`: For embedded directives in substitution definitions.
    - `Text`: Classifier of second line of a text block.
    - `SpecializedText`: Superclass for continuation lines of Text-variants.
    - `Definition`: Second line of potential definition_list_item.
    - `Line`: Second line of overlined section title or transition marker.
    - `Struct`: An auxiliary collection class.

:Exception classes:
    - `MarkupError`
    - `ParserError`
    - `MarkupMismatch`

:Functions:
    - `escape2null()`: Return a string, escape-backslashes converted to nulls.
    - `unescape()`: Return a string, nulls removed or restored to backslashes.

:Attributes:
    - `state_classes`: set of State classes used with `RSTStateMachine`.

Parser Overview
===============

The reStructuredText parser is implemented as a recursive state machine,
examining its input one line at a time.  To understand how the parser works,
please first become familiar with the `docutils.statemachine` module.  In the
description below, references are made to classes defined in this module;
please see the individual classes for details.

Parsing proceeds as follows:

1. The state machine examines each line of input, checking each of the
   transition patterns of the state `Body`, in order, looking for a match.
   The implicit transitions (blank lines and indentation) are checked before
   any others.  The 'text' transition is a catch-all (matches anything).

2. The method associated with the matched transition pattern is called.

   A. Some transition methods are self-contained, appending elements to the
      document tree (`Body.doctest` parses a doctest block).  The parser's
      current line index is advanced to the end of the element, and parsing
      continues with step 1.

   B. Other transition methods trigger the creation of a nested state machine,
      whose job is to parse a compound construct ('indent' does a block quote,
      'bullet' does a bullet list, 'overline' does a section [first checking
      for a valid section header], etc.).

      - In the case of lists and explicit markup, a one-off state machine is
        created and run to parse contents of the first item.

      - A new state machine is created and its initial state is set to the
        appropriate specialized state (`BulletList` in the case of the
        'bullet' transition; see `SpecializedBody` for more detail).  This
        state machine is run to parse the compound element (or series of
        explicit markup elements), and returns as soon as a non-member element
        is encountered.  For example, the `BulletList` state machine ends as
        soon as it encounters an element which is not a list item of that
        bullet list.  The optional omission of inter-element blank lines is
        enabled by this nested state machine.

      - The current line index is advanced to the end of the elements parsed,
        and parsing continues with step 1.

   C. The result of the 'text' transition depends on the next line of text.
      The current state is changed to `Text`, under which the second line is
      examined.  If the second line is:

      - Indented: The element is a definition list item, and parsing proceeds
        similarly to step 2.B, using the `DefinitionList` state.

      - A line of uniform punctuation characters: The element is a section
        header; again, parsing proceeds as in step 2.B, and `Body` is still
        used.

      - Anything else: The element is a paragraph, which is examined for
        inline markup and appended to the parent element.  Processing
        continues with step 1.
�reStructuredText�N)�FunctionType�
MethodType)�nodes�statemachine�utils)�ApplicationError�	DataError)�StateMachineWS�StateWS)�fully_normalize_name)�unescape�whitespace_normalize_name)�
directives�	languages�tableparser�roles)�escape2null�column_width)�punctuation_chars�roman�
urischemes)�split_escaped_whitespacec��eZdZdS)�MarkupErrorN��__name__�
__module__�__qualname__���{/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/docutils/parsers/rst/states.pyrry��������r!rc��eZdZdS)�UnknownInterpretedRoleErrorNrr r!r"r%r%zr#r!r%c��eZdZdS)�"InterpretedRoleNotImplementedErrorNrr r!r"r'r'{r#r!r'c��eZdZdS)�ParserErrorNrr r!r"r)r)|r#r!r)c��eZdZdS)�MarkupMismatchNrr r!r"r+r+}r#r!r+c��eZdZdZd�ZdS)�Structz3Stores data attributes for dotted-attribute access.c�:�|j�|��dS�N)�__dict__�update)�self�keywordargss  r"�__init__zStruct.__init__�s���
���[�)�)�)�)�)r!N)rrr�__doc__r4r r!r"r-r-�s)������=�=�*�*�*�*�*r!r-c��eZdZdZ		dd�ZdS)�RSTStateMachinezy
    reStructuredText's master StateMachine.

    The entry point to reStructuredText parsing is the `run()` method.
    rTNc	���tj|jj|j��|_||_|�t��}|�|j��t||j|jgdd|���|_
||_|�|j
��|j
j|_||_tj||||d���}|gks
Jd���dx|_|_
dS)z�
        Parse `input_lines` and modify the `document` node in place.

        Extend `StateMachineWS.run()`: set up parse-global data and
        run the StateMachine.
        NrF)�document�reporter�language�title_styles�
section_level�section_bubble_up_kludge�inliner�source)�input_sourcez.RSTStateMachine.run() results should be empty!)r�get_language�settings�
language_coder:r;�match_titles�Inliner�init_customizationsr-�memor9�attach_observer�note_source�noder�run)r2�input_linesr9�input_offsetrEr?�resultss       r"rLzRSTStateMachine.run�s��"�.���+�X�->�@�@��
�(����?��i�i�G��#�#�H�$5�6�6�6��H�$,�$5�$(�M�(*�)*�49�#*�
,�,�,��	�!��
����X�1�2�2�2��	�*��
���	� �$�T�;��2:�8�2D�F�F�F���"�}�}�}�N�}�}�}� $�$��	�D�I�I�Ir!)rTN�rrrr5rLr r!r"r7r7�s<��������GK��%�%�%�%�%�%r!r7c��eZdZdZdd�ZdS)�NestedStateMachinezh
    StateMachine run from within other StateMachine runs, to parse nested
    document structures.
    Tc��||_||_|j|_|�|jj��|j|_|j|_||_tj	|||��}|gks
Jd���|S)z�
        Parse `input_lines` and populate a `docutils.nodes.document` instance.

        Extend `StateMachineWS.run()`: set up document-wide data.
        z1NestedStateMachine.run() results should be empty!)
rErHr9rIrJr:r;rKrrL)r2rMrNrHrKrErOs       r"rLzNestedStateMachine.run�s}��)�����	��
��
����T�]�6�7�7�7��
��
��
��
���	� �$�T�;��E�E���"�}�}�}� (�}�}�}��r!N�TrPr r!r"rRrR�s2��������
�����r!rRc��eZdZdZeZgZdd�Zd�Zd�Z	d�Z
d�Z		dd	�Zdidddfd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�ZdS)�RSTStatez`
    reStructuredText State superclass.

    Contains methods used by all State subclasses.
    Fc�P�tdd�|_tj|||��dS)N�Body��
state_classes�
initial_state)rZ�nested_sm_kwargsrr4�r2�
state_machine�debugs   r"r4zRSTState.__init__�s2��2?�28�!:�!:������}�e�4�4�4�4�4r!c��tj|��|jj}||_|j|_|j|_|j|_|jj|_t|jd��s|jj
|j_
dSdS)N�get_source_and_line)r�runtime_initr^rHr:r?r9rK�parent�hasattrra)r2rHs  r"rbzRSTState.runtime_init�s�����T�"�"�"��!�&����	��
��
��|����
��
��(�-����t�}�&;�<�<�	W�04�0B�0V�D�M�-�-�-�	W�	Wr!c�^�	|j�|��dS#t$rYdSwxYw)zT
        Jump to input line `abs_line_offset`, ignoring jumps past the end.
        N)r^�	goto_line�EOFError)r2�abs_line_offsets  r"rfzRSTState.goto_line�sF��	���(�(��9�9�9�9�9���	�	�	��D�D�	���s��
,�,c��|j�d|jj�d|�d|�d|jj�d�	��|dgfS)zs
        Override `StateWS.no_match` to generate a system message.

        This code should never be run.
        z6Internal error: no transition pattern match.  State: "z"; transitions: z; context: z; current line: �.N)r:�severe�	__class__rr^�line)r2�context�transitionss   r"�no_matchzRSTState.no_match�s`��	
�
�����~�&�&�&����W�W�W��!�&�&�&�
(�	)�	)�	)�
��b� � r!c�
�ggfS)zCalled at beginning of file.r �r2rns  r"�bofzRSTState.bof�s���2�v�
r!Nc�F�d}|�|j}|dz
}|�|j}|dz
}t|��}d}	|dkr+	|j���}	n#t
$rYnwxYw|	s|dd|ji|��}	|	�|||j||���|dkr|j�	|	��n|	�
��|	���}
|jr@t|��|z
dkr*|j
�t|��|z
��|
S)zg
        Create a new StateMachine rooted at `node` and run it over the input
        `block`.
        rN��r_�rHrKrEr )�	nested_smr\�len�nested_sm_cache�pop�
IndexErrorr_rLrH�append�unlinkrhrcr^�	next_line)r2�blockrNrKrE�state_machine_class�state_machine_kwargs�use_default�block_lengthr^�
new_offsets           r"�nested_parsezRSTState.nested_parse�s������&�"&�.���1��K��'�#'�#8� ��1��K��5�z�z���
��!���
� $� 4� 8� 8� :� :�
�
���
�
�
���
�����	H�/�/�H�H�d�j�H�2F�H�H�M����%��D�I�#�,�	�	@�	@�	@��!���� �'�'�
�6�6�6�6�� � �"�"�"�"�2�2�4�4�
��<�	D�S��Z�Z�,�6�1�<�<���(�(��U���l�)B�C�C�C��s�A�
A�Ac��|	�|j}	|
�|j���}
||
d<|	dd|ji|
��}|�|}||j|_|���D]!\}}
t|j|||
���"|�|||j	||���|j|j}|�
��|���|fS)z�
        Create a new StateMachine rooted at `node` and run it over the input
        `block`. Also keep track of optional intermediate blank lines and the
        required final one.
        Nr[r_rwr )rxr\�copyr_�states�blank_finish�items�setattrrLrHr~rh)r2r�rNrKr[r��blank_finish_state�extra_settingsrEr�r�r^�key�values              r"�nested_list_parsezRSTState.nested_list_parse$s'���&�"&�.���'�#'�#8�#=�#=�#?�#?� �0=��_�-�+�+�D�D�$�*�D�.B�D�D�
��%�!.��@L�
��/�0�=�(�.�.�0�0�	E�	E�J�C���M�(��7��e�D�D�D�D����%��D�I�#�,�	�	@�	@�	@�$�+�,>�?�L���������,�,�.�.��<�<r!c�f�|�|||��r|�|||��dSdS)z=Check for a valid subsection and create one if it checks out.N)�check_subsection�new_subsection)r2�titler@�style�lineno�messagess      r"�sectionzRSTState.sectionBsD��� � ����7�7�	9�����v�x�8�8�8�8�8�	9�	9r!c�<�|j}|j}|j}	|�|��dz}ne#t$rXt|��|jkr|�|��YdS|xj|�||��z
c_YdSwxYw||krR||_t|��dkrd|_	|j
�t|��dz��t�||dzkrdS|xj|�||��z
c_dS)a�
        Check for a valid subsection header.  Return True or False.

        When a new section is reached that isn't a subsection of the current
        section, back up the line count (use ``previous_line(-x)``), then
        ``raise EOFError``.  The current StateMachine will finish, then the
        calling StateMachine can re-examine the title.  This will work its way
        back up the calling chain until the correct section level isreached.

        @@@ Alternative: Evaluate the title, store the title info & level, and
        back up the chain until that level is reached.  Store in memo? Or
        return in results?

        :Exception: `EOFError` when a sibling or supersection encountered.
        ruTFrv)
rHr<r=�index�
ValueErrorryr}rc�title_inconsistentr>r^�
previous_linerg)r2r@r�r�rHr<�mylevel�levels        r"r�zRSTState.check_subsectionGs8�� �y���(���$��	� �&�&�u�-�-��1�E�E���	�	�	��<� � �D�$6�6�6��#�#�E�*�*�*��t�t����t�6�6�v�v�F�F�F����u�u�
	�����G���!&�D���5�z�z�Q���04��-���,�,�S��Z�Z�!�^�<�<�<��N��G�a�K����4��K�K�4�2�2�6�6�B�B�B�K�K��5s�0�7B�*$B�Bc�f�|j�dtjd|��|���}|S)NzTitle level inconsistent:��rm)r:rkr�
literal_block)r2�
sourcetextr��errors    r"r�zRSTState.title_inconsistentps:���
�$�$�'��)<�R��)L�)L��%�����r!c��|j}|j}|xjdz
c_tj��}|xj|z
c_|�||��\}}tj|dg|�R�}	t|	�����}
|d�	|
��||	z
}||z
}||z
}|j
�||��|jj
dz}|j���dz}|�|jj|d�||d���}
|�|
��|j|krt$�||_dS)z?Append new subsection to document tree. On return, check level.rur��namesNT)rNrKrE)rHr=rr�rc�inline_textr��normalize_name�astextr}r9�note_implicit_targetr^�line_offsetrhr�rMrfrg)r2r�r�r�rHr��section_node�	textnodes�title_messages�	titlenode�name�offset�	absoffset�newabsoffsets              r"r�zRSTState.new_subsectionvsl���y���$�����a�����}�������|�#���$(�$4�$4�U�F�$C�$C�!�	�>��K��r�6�I�6�6�6�	��i�.�.�0�0�1�1���W��$�$�T�*�*�*��	�!���� ����&���
�*�*�<��F�F�F��#�/�!�3���&�6�6�8�8�1�<�	��(�(�� �,�V�W�W�5�I��d�)�4�4��	
���|�$�$�$����(�(��N�$����r!c���d�|�����}tjd|��rKt	|��dkrgdfS|ddvr|dd����}n
|dd�}d}n|}d	}|�||��\}}t
j|d
g|�R�}|j�	|��\|_
|_|g|z|fS)zW
        Return a list (paragraph & messages) & a boolean: literal_block next?
        �
z(?<!\\)(\\\\)*::$rvru���z 
N���rr�)�join�rstrip�re�searchryr�r�	paragraphr^rar@rm)	r2�linesr��data�text�literalnextr�r��ps	         r"r�zRSTState.paragraph�s����y�y����&�&�(�(��
�9�)�4�0�0�
	��4�y�y�A�~�~��1�u���b��U�"�"��C�R�C�y�'�'�)�)����C�R�C�y���K�K��D��K�"�.�.�t�V�<�<��	�8��O�D�"�1�y�1�1�1���-�A�A�&�I�I����!�&��s�X�~�{�*�*r!c�^�|j�|||j|j��\}}||fS)zX
        Return 2 lists: nodes (text and inline elements), and system_messages.
        )r?�parserHrc)r2r�r�rr�s     r"r�zRSTState.inline_text�s8���,�,�,�T�6�-1�Y���E�E���x��h��r!c�x�|j���dz}|j�d|z|���S)Nruz2%s ends without a blank line; unexpected unindent.r�)r^�abs_line_numberr:�warning)r2�	node_namer�s   r"�unindent_warningzRSTState.unindent_warning�sK���#�3�3�5�5��9���}�$�$�&<�>G�&H�*0�%�2�2�	2r!�F)FNN)rrrr5rRrxrzr4rbrfrprsr�r�r�r�r�r�r�r�r�r r!r"rVrV�s+��������#�I��O�5�5�5�5�

W�
W�
W����!�!�!����DI�DH�#�#�#�#�N.2�)+�',�.2�/3�
=�=�=�=�<9�9�9�
'�'�'�R���%�%�%�4+�+�+�*���2�2�2�2�2r!rVTc�6�|\}}}}g}|D]P}t|t��r$|�t|d�����;|�|���Qd�|��}dt��z}	|rt
j|	��S|	S)a!
    Build, compile and return a regular expression based on `definition`.

    :Parameter: `definition`: a 4-tuple (group name, prefix, suffix, parts),
        where "parts" is a list of regular expressions and/or regular
        expression definitions to be joined into an or-group.
    N�|z.%(prefix)s(?P<%(name)s>%(or_group)s)%(suffix)s)�
isinstance�tupler}�build_regexpr��localsr��compile)
�
definitionr�r��prefix�suffix�parts�part_strings�part�or_group�regexps
          r"r�r��s���#-��D�&�&�%��L��&�&���d�E�"�"�	&�����T�4� 8� 8�9�9�9�9�����%�%�%�%��x�x��%�%�H�
=����
H�F����z�&�!�!�!��
r!c
��eZdZdZd�Zd�Zd�ZdZdZdZ	dZ
d	Zd
ZdZ
dZd
e��zZdZdZd�Z	d'd�Zd�Zd�Zd�Zd�Zd(d�Zd�Zd�Zd�Zd�Zd�Zd�Zd'd�Z d �Z!d!�Z"d"�Z#d#Z$d$�Z%d%�Z&eeeeeeee e!d&�	Z'dS))rFz9
    Parse inline markup; call the `parse()` method.
    c��g|_dSr/)�implicit_dispatch)r2s r"r4zInliner.__init__�s��!#���	#�	#r!c�N�t|dd��rd}d}nDdtj�tj�d�}dtj�tj�tj�d�}t
�����}|�t|j
����d|dd	d|jgd
�fdd|d|jzd
dddd|jzdd|jzgfgfdd|jz|jdgfgf}||_
||_||_t!t#|��t%j|jdz|z��t%j|jdz|z��t%jd|zt$j��t%jd|zt$j��t%j|jdz|z��t%j|jdz|z��t%j|jdz|z��t%j|j|zdzt$j��t%jd|jzd z|zt$j��t%jd!|zt$j��t%jd"|zt$j���#��|_|j�|jj|jf��|jr+|j�|jj|jf��|j r-|j�|jj!|j"f��dSdS)$N�character_level_inline_markupFz
(^|(?<!))r�z(^|(?<=\s|[z]))z($|(?=\s|[�initial_inline�start)z\*\*z\*(?!\*)�``�_`z\|(?!\|)�wholez(?P<refname>%s)(?P<refend>__?)�
footnotelabelz\[z(?P<fnend>\]_)�[0-9]+z\#(%s)?z\*z(?P<citationlabel>%s)�	backquotez(?P<role>(:%s:)?)z`(?!`)z(\*)z(\*\*)a
              %(non_unescaped_whitespace_escape_before)s
              (
                `
                (?P<suffix>
                  (?P<role>:%(simplename)s:)?
                  (?P<refend>__?)?
                )
              )
              %(end_string_suffix)s
              a�
              (
                (?:[ \n]+|^)            # spaces or beginning of line/string
                <                       # open bracket
                %(non_whitespace_after)s
                (([^<>]|\x00[<>])+)     # anything but unescaped angle brackets
                %(non_whitespace_escape_before)s
                >                       # close bracket
              )
              $                         # end of string
              z(``)z(`)z
(\|_{0,2})�$a5
                %(start_string_prefix)s
                (?P<whole>
                  (?P<absolute>           # absolute URI
                    (?P<scheme>             # scheme (http, ftp, mailto)
                      [a-zA-Z][a-zA-Z0-9.+-]*
                    )
                    :
                    (
                      (                       # either:
                        (//?)?                  # hierarchical URI
                        %(uric)s*               # URI characters
                        %(uri_end)s             # final URI char
                      )
                      (                       # optional query
                        \?%(uric)s*
                        %(uri_end)s
                      )?
                      (                       # optional fragment
                        \#%(uric)s*
                        %(uri_end)s
                      )?
                    )
                  )
                |                       # *OR*
                  (?P<email>              # email address
                    z]
                  )
                )
                %(end_string_suffix)s
                a
                %(start_string_prefix)s
                (
                  (pep-(?P<pepnum1>\d+)(.txt)?) # reference to source file
                |
                  (PEP\s+(?P<pepnum2>\d+))      # reference by name
                )
                %(end_string_suffix)sz{
                %(start_string_prefix)s
                (RFC(-|\s+)?(?P<rfcnum>\d+))
                %(end_string_suffix)s)�initial�emphasis�strong�interpreted_or_phrase_ref�
embedded_link�literal�target�substitution_ref�email�uri�pep�rfc)#�getattrr�openers�
delimiters�closing_delimiters�closersr�r�r1�varsrl�non_whitespace_after�
simplename�start_string_prefix�end_string_suffixr�r-r�r�r��non_whitespace_escape_before�VERBOSE�non_whitespace_before�
email_pattern�patternsr�r}r��standalone_uri�pep_referencesr��
pep_reference�rfc_referencesr��
rfc_reference)r2rCr�r��argsr�s      r"rGzInliner.init_customizations�s����8�<�e�D�D�
	>�"1�� "���
	>�
%6�$=�$=�$5�$@�$@�$@�$B���#4�"F�"F�"3�">�">�"3�";�";�";�"=���x�x�}�}�������D���(�(�)�)�)�!�#6��
�b�$�3����
��b�+�/�$�/�A���'8���T�_�,��(�4�?�:���	�
��
 �4�?�
2�
�
&��Z�
�)�
��8$7�� �!2�����
���u�%�%��:�d�?� '�(�*;�<�=�=���D�=�'�(�*;�<�=�=�$&�J�
��
��*�%&�%&��
�
��
��*�&�&��*�T�7�&�@�0�1�2�2���D�=�$�%�'8�9�:�:��:�d�&G�(5�'6�(9�':�;�;��
�4�-��4�s�:��:�'�'��j��4�,�5-�40�5�<�=�< �Z�?)�)�@�j�)�,0�0�24��=�=��j�)�,0�0�24��	=�=�aT>�T>�T>��
�l	
��%�%�t�}�'8�'+�':�'<�	=�	=�	=��"�	@��"�)�)�4�=�+<�+/�+=�+?�
@�
@�
@��"�	@��"�)�)�4�=�+<�+/�+=�+?�
@�
@�
@�
@�
@�	@�	@r!c�|�|j|_|j|_|j|_||_|jjj}|j}t|��}g}g}	g}
|r�||��}|r�|�	��}||dp|dp|dp|d}
|
|||��\}}}}|	�
|��|
|z
}
|r3||�d�|	��|��z
}||z
}g}	nn|��d�|	��|z}|r||�||��z
}||
fS)a@
        Return 2 lists: nodes (text and inline elements), and system_messages.

        Using `self.patterns.initial`, a pattern which matches start-strings
        (emphasis, strong, interpreted, phrase reference, literal,
        substitution reference, and inline target) and complete constructs
        (simple reference, footnote reference), search for a candidate.  When
        one is found, check for validity (e.g., not a quoted '*' character).
        If valid, search for the corresponding end string if applicable, and
        check it for validity.  If not found or invalid, generate a warning
        and ignore the start-string.  Implicit inline markup (e.g. standalone
        URIs) is found last.

        :text: source string
        :lineno: absolute line number (cf. statemachine.get_source_and_line())
        r�r��refend�fnendr�)
r:r9r;rcrr�r��dispatchr�	groupdictr}�implicit_inliner�)r2r�r�rHrc�pattern_searchr
�	remaining�	processed�unprocessedr��match�groups�method�before�inlines�sysmessagess                 r"r�z
Inliner.parsefs���&�
��
��
��
��
��
������.�5���=����%�%�	��	������	�"�N�9�-�-�E��
����*�*��!�&��/�#I�V�K�5H�#I�%+�H�%5�#I�9?���J��:@�&��u�AG�;I�;I�7����K��"�"�6�*�*�*��K�'���%���!5�!5�b�g�g�k�6J�6J�6<�">�">�>�I���(�I�"$�K���!�	�"�G�G�K�(�(�9�4�	��	A���-�-�i��@�@�@�I��(�"�"r!z(?<!\s)z
(?<![\s\x00])z(?<!(?<!\x00)[\s\x00])z(?!\s)z$(?:(?!_)\w)+(?:[-._+:](?:(?!_)\w)+)*z%[-_.!~*'()[\];/:@&=+$,%a-zA-Z0-9\x00]z[>]z[_~*/=+a-zA-Z0-9]z-(?:%(urilast)s|%(uric)s(?=%(uri_end_delim)s))z"[-_!~*'{|}/#?^`&=+$%a-zA-Z0-9\x00]z�
          %(emailc)s+(?:\.%(emailc)s+)*   # name
          (?<!\x00)@                      # at
          %(emailc)s+(?:\.%(emailc)s*)*   # host
          %(uri_end)s                     # final URI char
          c���|j}|���}|dkrdS||dz
}	||���}n#t$rYdSwxYwt	j||��S)z�Test if inline markup start-string is 'quoted'.

        'Quoted' in this context means the start-string is enclosed in a pair
        of matching opening/closing delimiters (not necessarily quotes)
        or at the end of the match.
        rFruT)�stringr��endr|r�match_chars)r2rrr��prestart�	poststarts      r"�quoted_startzInliner.quoted_start�s���������
�
���A�:�:��5��%�!�)�$��	��u�y�y�{�{�+�I�I���	�	�	��4�4�	���� �,�X�y�A�A�As�A�
A�AFc�2�|j}|�d��}|�d��}|�|��r|d|�g||d�gdfS|�||d���}	|	r�|	�d��r�|	jd|	�d���}
|rt|
d��}
||	�d��z}t|||�d��}|||
��}
|d|�|
g||d�g|	�d��fS|j�d|j	z|���}t|||�d��}
|�
|
|
|��}|d|�|g||d�|gdfS)Nr�r�ruTz*Inline %s start-string without end-string.r�)rr�rr r�r�groupr:r�r�problematic)r2rr��end_pattern�	nodeclass�restore_backslashesr�
matchstart�matchend�endmatchr��textend�	rawsourcerK�msg�prbs                r"�
inline_objzInliner.inline_obj�s�������[�[��)�)�
��9�9�W�%�%�����U�#�#�	D��)�8�)�$�b�&����*;�R��C�C��%�%�f�X�Y�Y�&7�8�8���	=����q�)�)�	=��?�#5�H�N�N�1�$5�$5�#5�6�D�"�
,���d�+�+������a���0�G� ��
�7�(:�!;�T�B�B�I��9�Y��-�-�D��;�J�;�'�$���7�8�8�$�b�(�.�.��*;�*;�=�
=��m�#�#�:��"�#�)/�$�1�1����z�(�2�3�T�:�:�����t�T�3�/�/���k�z�k�"�S�E�6�(�)�)�+<�s�e�R�G�Gr!c���|j�||j��}tj|||���}|j�|��}|�|��|S)N)�refid)r9�set_idrcrr#�add_backref)r2r�r+�message�msgidr#�prbids       r"r#zInliner.problematic�sa���
�$�$�W�d�k�:�:���'�	�4�u�E�E�E���
�$�$�[�1�1�����E�"�"�"��r!c�r�|�|||jjtj��\}}}}}||||fSr/)r.rr�r�r2rr�rrrr�	endstrings        r"r�zInliner.emphasis�sA��=A�_�_��V�T�]�3�U�^�>E�>E�:����K���w�	�;�6�6r!c�r�|�|||jjtj��\}}}}}||||fSr/)r.rr�rr7s        r"r�zInliner.strong�sA��=A�_�_��V�T�]�1�5�<�>A�>A�:����K���w�	�;�6�6r!c��|jj}|j}|�d��}|�d��}|�d��}|�d��}d}	|r
|dd�}d}	n+|�|��r|d|�g||d�gfS|�||d���}
|
�r�|
�d���r�||
���z}|
�d��r�|rc|j�	d|���}t|||�d	��}
|�|
|
|��}|d|�|g||d�|gfS|
�d
��dd�}d
}	|
jd|
�d���}t|||�d	��}|dd�dkr�|rf|j�	d|	z|���}t|||�d	��}
|�|
|
|��}|d|�|g||d�|gfS|�|d|�||d�||��St|||�d	��}|�
||||��\}}|d|�|||d�|fS|j�	d
|���}t|||�d	��}
|�|
|
|��}|d|�|g||d�|gfS)Nr��roler�rur�r�zVMultiple roles in interpreted text (both prefix and suffix present; only one allowed).r�Tr��_z=Mismatch: both interpreted text role %s and reference suffix.zLInline interpreted text or phrase reference start-string without end-string.)rr�rr�rr"r r�r:r�rr#�
phrase_ref�interpreted)r2rr�r$rr'r(�	rolestartr;�positionr)r*r,r�r-�escapedr+�nodelistr�s                   r"r�z!Inliner.interpreted_or_phrase_ref�s����m�=������[�[��-�-�
��9�9�[�)�)���K�K��'�'�	��{�{�6�"�"�����	@���"��:�D��H�H�
�
�
�u�
%�
%�	@��)�8�)�$�b�&����*;�R�?�?��%�%�f�X�Y�Y�&7�8�8���	4����q�)�)�	4�������/�G��~�~�f�%�%�

$��N��-�/�/�H�#�0�%�%�C�$�F�9�W�+<�$=�t�D�D�D��*�*�4��s�;�;�C�!�*�9�*�-��u�f�W�X�X�6F���M�M��~�~�h�/�/��"��5��#���o�&8�x�~�~�a�'8�'8�&8�9�G� ��
�7�(:�!;�T�B�B�I�����~��$�$��N��-�/�/�.�08�9�?E�0�G�G�C�$�F�9�W�+<�$=�t�D�D�D��*�*�4��s�;�;�C�!�*�9�*�-��u�f�W�X�X�6F���M�M����v�k�z�k�':�F�7�8�8�<L�'0�'�;�;�;�%�V�I�g�,=�%>��E�E�	�%)�%5�%5�i��$�6<�&>�&>�"��(��z�	�z�*�H��w�x�x�(�(�4�4��m�#�#�$�*0�$�2�2����z�(�2�3�T�:�:�����t�T�3�/�/���k�z�k�"�S�E�6�(�)�)�+<�s�e�C�Cr!Nc�,�|jj�|��}|�r|d|�d���}t	|��}t	|d��}|�d��}	t	|	d��}
|
�d��}|	�d��r�|s�|jj�|	��syd}tt	|	dd�����}
tj|�d��|
�	��}tt	|	dd�����|_
n�d
}t|�d����}d�d�|D����}
|�t	|
����}
|
�d��r
|
dd
�dz}
tj|�d��|
���}d|_|	st%d|	z���|s|
}t	|��}|
}n#|}t	|��}d}t	|d��}t|��}tj||t|�����}||d_|g}|d
d�dkr<|r&|dkr |
|d<|j�|��n�|r|d
kr|
|d<n�d|d<n�|r�|d�|��|dkr:|
|d<|j�|��|j�|��n%|
|d<|j�||j��|�|��n||d<|j�|��|||gfS)NrTrvz\_r<r�r�ru��refnamer�� c3�dK�|]+}d�|�����V��,dS�r�N)r��split��.0r�s  r"�	<genexpr>z%Inliner.phrase_ref.<locals>.<genexpr>9sJ����!:�!:�%)�"$��������!6�!6�!:�!:�!:�!:�!:�!:r!�����refurizproblem with embedded link: %r�r��__rErO�	anonymousr�)rr�r�r�rr"�endswithr�rr�rr�r�indirect_reference_namerr��
adjust_uri�
referencedr	�	referencer+r9�note_refnamer}�note_indirect_target�note_explicit_targetrc)r2r�afterr+rAr�r�	unescaped�rawtext�	aliastext�rawaliastext�underscore_escaped�	aliastype�aliasr��alias_partsrErW�	node_lists                   r"r=zInliner.phrase_ref#s����
�+�2�2�7�;�;���%	.��?�E�K�K��N�N�?�+�D� ����I��t�T�*�*�G����A���I�#�I�t�4�4�L�!-�!6�!6�u�!=�!=���"�"�3�'�'�
&�+�
&� �M�-�3�3�I�>�>�
&�#�	�&�x�	�#�2�#��'?�'?�@�@����e�k�k�!�n�n�e�D�D�D��1J�4<�Y�s��s�^�4L�4L�2N�2N��.�.�"�	�6�u�{�{�1�~�~�F�F�����!:�!:�-8�!:�!:�!:�:�:���������8�8���>�>�%�(�(�-�!�#�2�#�J��,�E���e�k�k�!�n�n�U�C�C�C��$%��!��
4�&�'G�)2�(3�4�4�4��
'���$�T�N�N�	�&����D� ����I��F��w��-�-�G� ��+�+���O�I�t�)B�9�)M�)M�O�O�O�	�!(�	�!����K�	��R�S�S�>�T�!�!��
+�9��.�.�',�	�)�$��
�*�*�9�5�5�5�5��
+�Y�%�/�/�&+�	�(�#�#�)*�	�+�&�&��

6��w��&�&�w�/�/�/���&�&�+0�I�i�(��M�6�6�v�>�>�>��M�.�.�y�9�9�9�9�*/�I�h�'��M�6�6�v�t�{�K�K�K�� � ��(�(�(�(�'.�	�)�$��
�*�*�9�5�5�5��y�%��+�+r!c�R�|jj�|��}|rd|zS|S)N�mailto:)rr�r)r2r�rs   r"rUzInliner.adjust_urins1���
�#�)�)�#�.�.���	��s�?�"��Jr!c��tj||j||j��\}}|r||||||��\}}|||zfS|j�d|z|���}	|�|||	��g||	gzfS)Nz#Unknown interpreted text role "%s".r�)rr;r;r:r�r#)
r2r+r�r;r��role_fnr�r�	messages2r,s
          r"r>zInliner.interpretedus���!�J�t�T�]�F�'+�}�6�6�����	&�&�w�t�Y��f�d�K�K��E�9��(�Y�.�.�.��-�%�%�5��<��&���C��%�%�i��C�@�@�A���u�$�&�
&r!c�v�|�|||jjtjd���\}}}}}||||fS)NT)r&)r.rr�rr7s        r"r�zInliner.literal�sJ��=A�_�_��V�T�]�2�E�M�"&�>M�>(�>(�:����K���w�	�;�6�6r!c��|�|||jjtj��\}}}}}|r�t	|dtj��ryt|��dksJ�|d}t
|�����}	|d�|	��|j	�
||j��||||fS)Nrrur�)r.rr�rr�ryr�r�r}r9rZrc)
r2rr�rrrrr8r�r�s
          r"�inline_internal_targetzInliner.inline_internal_target�s���=A�_�_��V�T�]�1�5�<�>A�>A�:����K���	D�z�'�!�*�e�l�;�;�	D��w�<�<�1�$�$�$�$��Q�Z�F�!�&�-�-�/�/�2�2�D��7�O�"�"�4�(�(�(��M�.�.�v�t�{�C�C�C��w�	�;�6�6r!c��|�|||jjtj��\}}}}}t|��dkr�|d}t
|tj��r�|���}	|j�	||	��|dd�dkrbtj
d|	�|��d��}
|dd�dkrd|
d	<n,t|	��|
d
<|j�|
��|
|z
}
|
g}||||fS)Nrurr�r<r�r�rMrQrRrE)
r.rr�r�substitution_referenceryr�r�r9�note_substitution_refrWr�rX)r2rr�rrrrr8�subref_node�subref_text�reference_nodes           r"rnzInliner.substitution_reference�s+��=A�_�_��V�T�]�;��*�>,�>,�:����K���w�<�<�1���!�!�*�K��+�u�'C�D�D�
/�)�0�0�2�2���
�3�3�K��M�M�M��R�S�S�>�S�(�(�%*�_�_�#.�;�	�	�:�B�&@�&@�N� ����~��-�-�67��{�3�3�4B�;�4O�4O��y�1��
�2�2�>�B�B�B�"�k�1�N�-�.�G��w�	�;�6�6r!c�X�|�d��}t|��}|j}|d|�d���}||�d��d�}|�d��rKtjd|z|���}|tj|��z
}|j�	|��n�tj
d|z��}|ddkr*|d	d�}d	|d
<|j�|��n?|dkr"d}d|d
<|j�|��n|tj|��z
}|r||d
<|j�
|��tj|jj��r|���}||g|gfS)ze
        Handles `nodes.footnote_reference` and `nodes.citation_reference`
        elements.
        r�Nr��
citationlabelz[%s]_rDr�#ru�auto�*r�rE)r"r�rr�rr�citation_reference�Textr9�note_citation_ref�footnote_reference�note_autofootnote_ref�note_symbol_footnote_ref�note_footnote_refr�get_trim_footnote_ref_spacerCr�)	r2rr��labelrErrr�refnodes	         r"r{zInliner.footnote_reference�s���
���O�,�,�� ��'�'������-����W�-�-�-�.���5�9�9�W�-�-�.�.�/�	��;�;��'�'�	)��.�w���7>�@�@�@�G��u�z�%�(�(�(�G��M�+�+�G�4�4�4�4��.�w���?�?�G��q�z�S� � �!�!�"�"�+��"#�����
�3�3�G�<�<�<�<��C�����"%�����
�6�6�������5�:�e�,�,�,���
9�%,��	�"��
�/�/��8�8�8��0���1G�H�H�
)���������y�)�R�/�/r!c��|�d��}t|��}tj||�d��z|t	|�����}||d_|rd|d<n||d<|j�|��|j}|�	d��}|�
d��}	|d|�|g||	d�gfS)NrErrPrrurRr�)r"r�rrWrr+r9rXrr�r)
r2rr�rR�
referencenamerE�
referencenoderr'r(s
          r"rWzInliner.reference�s������I�.�.�
� ��/�/�����E�K�K��1�1�1�=�*�=�9�9�;�;�;�
�&3�
�a��"��	6�)*�M�+�&�&�'.�M�)�$��M�&�&�}�5�5�5�����[�[��)�)�
��9�9�W�%�%���k�z�k�"�]�O�V�H�I�I�5F��J�Jr!c�2�|�||d���S)NT)rR)rW)r2rr�s   r"�anonymous_referencezInliner.anonymous_reference�s���~�~�e�V�t�~�<�<�<r!c�r�|�d��r3|�d�����tjvri|�d��rd}nd}|�d��}|t	|��z}tjt	|d��||���}|gSt�)N�schemer�rfr�r�TrN)r"�lowerr�schemesrrrWr+)r2rr��	addschemer�rOrWs       r"rzInliner.standalone_uri�s������H�%�%�	!��;�;�x�(�(�.�.�0�0�J�4F�F�F��{�{�7�#�#�
�%�	�	��	��;�;�w�'�'�D���$���/�F�����t�(<�(<�d�/5�7�7�7�I��;�� � r!c���|�d��}|�d��r0tt|�d������}nL|�d��r0tt|�d������}nt�|jjj|jjj|zz}tj
t|d��||���gS)Nrzpep-�pepnum1�PEP�pepnum2TrN)r"�
startswith�intrr+r9rC�pep_base_url�pep_file_url_templaterrW)r2rr�r��pepnum�refs      r"rzInliner.pep_reference�s����{�{�1�~�~���?�?�6�"�"�	!���%�+�+�i�"8�"8�9�9�:�:�F�F�
�_�_�U�
#�
#�	!���%�+�+�i�"8�"8�9�9�:�:�F�F� � ��}�%�2���'�=��F�G������t� 4� 4�d�3�G�G�G�H�Hr!z
rfc%d.htmlc�H�|�d��}|�d��rLtt|�d������}|jjj|j|zz}nt�tj
t|d��||���gS)Nr�RFC�rfcnumTrN)r"r�r�rr9rC�rfc_base_url�rfc_urlr+rrW)r2rr�r�r�r�s      r"rzInliner.rfc_reference�s����{�{�1�~�~���?�?�5�!�!�	!���%�+�+�h�"7�"7�8�8�9�9�F��-�(�5���v�8M�M�C�C� � �����t� 4� 4�d�3�G�G�G�H�Hr!c�~�|sgS|jD]�\}}|�|��}|r�	|�|d|����|��|||��z|�||���d�|��zcS#t
$rY��wxYw��t
j|��gS)a
        Check each of the patterns in `self.implicit_dispatch` for a match,
        and dispatch to the stored method for the pattern.  Recursively check
        the text before and after the match.  Return a list of `nodes.Text`
        and inline element nodes.
        N)r�r�rr�rr+rry)r2r�r��patternrrs      r"rzInliner.implicit_inlines����	��I�#�5�
	�
	�O�G�V��N�N�4�(�(�E��
��!�0�0��n�u�{�{�}�}�n�1E�v�N�N�$�f�U�F�3�3�4�"�2�2�4��	�	�����3E�v�N�N�O�P�P�P��&�����D�����
��
�4� � �!�!s�A-B�
B&�%B&)	rwz**�`r�r�z]_r�r<rQr�r/)(rrrr5r4rGr�rr��&non_unescaped_whitespace_escape_beforer�r��uric�
uri_end_delim�urilastr��uri_end�emailcrr r.r#r�r�r�r=rUr>r�rlrnr{rWr�rrr�rrr
r r!r"rFrF�s��������#�#�#�
M@�M@�M@�^1#�1#�1#�l'��#3� �-F�*�$��8�J�8�D��M�&�G�C�V�V�X�X�M�G�
6�F��M�B�B�B�&(-�H�H�H�H�0���7�7�7�
7�7�7�
2D�2D�2D�hI,�I,�I,�I,�V���&�&�&�7�7�7�	7�	7�	7�7�7�7�*!0�!0�!0�FK�K�K�K�"=�=�=�
!�
!�
!�
I�
I�
I��G�I�I�I�"�"�"�,��.��,�(�+��)�+�+�H�H�Hr!rF�aruc�&�t|��|z
Sr/��ord��s�_zeros  r"�_loweralpha_to_intr�&����q�6�6�E�>�r!�Ac�&�t|��|z
Sr/r�r�s  r"�_upperalpha_to_intr�*r�r!c�N�tj|�����Sr/)r�	fromRoman�upper)r�s r"�_lowerroman_to_intr�.s���?�1�7�7�9�9�%�%�%r!c
� �eZdZdZejjZ	e��Z	edddd���edddd���edd	dd���d
�e_	ej	�
��e_gd�e_dd
dddd�e_
eeeeejd�e_ie_ejD](Zejej
edz��eje<�)ejd��Z	ejd��Z	ejd��Z	iZ	ded<ded<ded<ded<dej
zed<dezed <d!ezed"<d#ezed$<d%ezed&<d'ezed(<ejD]TZd)e�d*ejej	ej���ed�ejej	ej ���d�ee<�Ud+d,ezd-d.ezd/d0eed1d2d3ezdd4�Z!d4Z"d5�Z#d6�Z$ejd7��Z%d8�Z&d9�Z'd:�Z(d;�Z)d<�Z*d=�Z+dxd?�Z,d@�Z-dA�Z.dB�Z/dC�Z0dD�Z1dE�Z2dF�Z3dG�Z4dH�Z5dI�Z6dJ�Z7dK�Z8dL�Z9dM�Z:dN�Z;dO�Z<dP�Z=dQ�Z>dR�Z?dS�Z@dydT�ZAdzdU�ZBdV�ZCe��ZD	eejdWeEeF��zejG��ejdXeEeF��zejG��ejdYeEeF��zejG���Z��eD_!d[�ZHd\�ZId]�ZJd^�ZKd_�ZLd`�ZMda�ZNdb�ZOdc�ZPdd�ZQde�ZRdf�ZSdg�ZTdh�ZUdi�ZVdj�ZWdk�ZXeHejdleFjYzejG��feIejdmeFjYzejG��feJejdnejG��feOejdoejG��feQejdpeFjYzejG��fgeD_Zdq�Z[dr�Z\ds�Z]dt�Z^du�Z_dv�Z`dw�Zad>S){rXz:
    Generic classifier of the first line of a block.
    �(�)rur�)r�r�r�rr�rrj)�parens�rparen�period)�arabic�
loweralpha�
upperalpha�
lowerroman�
upperromanr�z[a-z]z[A-Z]z
[ivxlcdm]+z
[IVXLCDM]+r�z\+-[-+]+-\+ *$z=+( +=+)+ *$z=+[ =]*$z[!-/:-@[-`{-~]�nonalphanum7bitz[a-zA-Z]�alphaz[a-zA-Z0-9]�alphanumz
[a-zA-Z0-9_-]�alphanumpluszJ(%(arabic)s|%(loweralpha)s|%(upperalpha)s|%(lowerroman)s|%(upperroman)s|#)�enumz%(alphanum)s%(alphanumplus)s*�optnamez%(%(alpha)s%(alphanumplus)s*|<[^<>]+>)�optargz!(-|\+)%(alphanum)s( ?%(optarg)s)?�shortoptz"(--|/)%(optname)s([ =]%(optarg)s)?�longoptz(%(shortopt)s|%(longopt)s)�optionz(?P<�>u[-+*•‣⁃]( +|$)z((%(parens)s|%(rparen)s|%(period)s)( +|$)z1:(?![: ])([^:\\]|\\.|:(?!([ `]|$)))*(?<! ):( +|$)z"%(option)s(, %(option)s)*(  +| ?$)z	>>>( +|$)z\|( +|$)z
\.\.( +|$)z__( +|$)z(%(nonalphanum7bit)s)\1* *$)�bullet�
enumerator�field_marker�
option_marker�doctest�
line_block�grid_table_top�simple_table_top�explicit_markuprRrmr�c���|j���\}}}}|�||��}|xj|z
c_|s#|xj|�d��z
c_||gfS)zBlock quote.zBlock quote)r^�get_indented�block_quotercr�)	r2rrn�
next_state�indented�indentr�r��elementss	         r"r�zBody.indent�s|���
�
,�
,�
.�
.�	��6�;���#�#�H�k�:�:�����x�����	@��K�K�4�0�0��?�?�?�K�K��
�B�&�&r!c���g}|r�tjd�|�����}|j�|dz��\|_|_|�||��\}}}}}|�|||��|�	|��|r&|�
|||z��\}	}
||	z
}||
z
}|}|r!|ds|dd�}|dz
}|r|d�|��|S)Nr��r+rur)rr�r�r^rar@rm�split_attributionr�r}�parse_attribution)r2r�r�r��
blockquote�blockquote_lines�attribution_lines�attribution_offset�new_line_offset�attributionr�s           r"r�zBody.block_quote�s@�����	!��*�T�Y�Y�x�5H�5H�I�I�I�J��#�7�7��A�
�F�F�
�Z�
�
��!%� 6� 6�x�� M� M�	
�
�
�
�
�
����.��Z�H�H�H��O�O�J�'�'�'� �
%�(,�(>�(>�%�{�3E�'E�)G�)G�%��X��k�)�
��H�$��)�K��
!�8�A�;�
!�#�A�B�B�<���q� ���
!�8�A�;�
!�#�	!�(�r!u(---?(?!-)|—) *(?=[^ \n])c���d}d}tt|����D]�}||���}|r�|r�||dz
kr�|j�|��}|r�|�||��\}}	|rf|||�}
|
�|���d���|
�|	d���|d|�|
|||d�||zfcSd}��|}��|ddddfS)a�
        Check for a block quote attribution and split it off:

        * First line after a blank line must begin with a dash ("--", "---",
          em-dash; matches `self.attribution_pattern`).
        * Every line after that must have consistent indentation.
        * Attributions must be preceded by block quote content.

        Return a tuple of: (block quote content lines, attribution lines,
        attribution offset, remaining indented lines, remaining lines offset).
        NFru)r)r�T)�rangeryr��attribution_patternr�check_attribution�	trim_leftr)r2r�r��blank�
nonblank_seen�irmr�attribution_endr��a_liness           r"r�zBody.split_attribution�sK�����
��s�8�}�}�%�%�	4�	4�A��A�;�%�%�'�'�D��
� �C�U�a�!�e�^�^� �4�:�:�4�@�@�E��	C�26�2H�2H�$�a�3)�3)�/���*�C�&.�q��/@�&A�G�#�-�-�e�i�i�k�k�q�-�A�A�A�#�-�-�f�A�-�>�>�>�$,�R�a�R�L�'�$%�x��0@�0@�'A�$/�/�$A�$C�C�C�C�!%�
�
�����T�4��t�3�3r!c��d}|dz}t|dzt|����D]�}||���}|snr|�2t|��t|�����z
}�Tt|��t|�����z
|krdS��|dz
}||pdfS)zt
        Check attribution shape.
        Return the index past the end of the attribution, and the indent.
        Nru)NNr)r�ryr��lstrip)r2r��attribution_startr�r�rms      r"r�zBody.check_attribution�s���
����!���(�1�,�c�(�m�m�<�<�
	�
	�A��A�;�%�%�'�'�D��
����~��T���S������%7�%7�7����T���S������/�/�/�6�9�9�!�z�z�:�
��F�A��6�;�Q��r!c��d�|�����}d|z}|�||��\}}tj|dg|�R�}|j�|��\|_|_||fS)Nr�rur�)	r�r�r�rr�r^rar@rm)r2r�r�r�r�r�r�rKs        r"r�zBody.parse_attribution�s����y�y��"�"�)�)�+�+���[���"�.�.�t�V�<�<��	�8�� ��r�6�I�6�6�6��!%�!3�!G�!G��!O�!O����T�Y��X�~�r!c�@�tj��}|j���\|_|_|xj|z
c_|jd|d<|�|�	����\}}||z
}|jj
dz}|�|jj|d�|j�
��dz|d|���\}}|�|��|s#|xj|�d��z
c_g|gfS)�Bullet list item.rr�ruN�
BulletList�rNrKr[r�zBullet list)r�bullet_listr^rar@rmrcr�	list_itemrr�r�rMrhrfr�)	r2rrnr��
bulletlistr�r�r�r�s	         r"r�zBody.bullet�s���&�(�(�
� �.�B�B�D�D�	��	�	�����z�!���$�|�A��
�8���.�.������5�5���<��a��
��#�/�!�3��(,�(>�(>�� �,�V�W�W�5��-�=�=�?�?�!�C��\�'�	)?�))�))�%���
	
����'�'�'��	@��K�K�4�0�0��?�?�?�K�K��:�r�!�!r!c�0�|jj|d�r|j�|��\}}}n|j�|��\}}}}t	jd�|����}|r|�|||���||fS)Nr��rNrK)r^rm�get_known_indented�get_first_known_indentedrr�r�r�)r2r�r�r�r��listitems      r"r�zBody.list_items�����"�6�7�7�+�	E��"�5�5�f�=�=�
0�H�k�<�<��"�;�;�F�C�C�
8�H�f�k�<��?�4�9�9�X�#6�#6�7�7���	-����h�[�#+�
�
-�
-�
-���%�%r!c�r�|�|��\}}}}|�|||��stjd���t	j��}|xj|z
c_|dkrd|d<n||d<|jj|j	|d<|jj|j
|d<|dkr6||d<|j�d	|�d
|�d���}	|xj|	z
c_|�
|�����\}
}||
z
}|jjdz}|�|jj|d�|j���dz|d
||||dkd����\}
}|�|
��|s#|xj|�d��z
c_g|gfS)zEnumerated List Itemr�rur��enumtyper�r�rur�z,Enumerated list start value not ordinal-1: "z" (ordinal r�N�EnumeratedList)�lastordinal�formatrv)rNrKr[r�r�zEnumerated list)�parse_enumerator�is_enumerated_list_itemr�TransitionCorrectionr�enumerated_listrcr��
formatinfor�r�r:�infor�rr^r�r�rMrhrfr�)r2rrnr�r�sequencer��ordinal�enumlistr,r�r�r��newline_offsets              r"r�zBody.enumerators���*.�*?�*?��*F�*F�'���$���+�+�G�X�v�F�F�	<��3�F�;�;�;��(�*�*�����x�����s�?�?�#+�H�Z� � �#+�H�Z� �!�Y�1�&�9�@����!�Y�1�&�9�@�����a�<�<� '�H�W���-�$�$�$��4�4����"�#�#�C�
�K�K�3��K�K�!%����	�	���!<�!<���,��H����#�/�!�3��'+�'=�'=�� �,�V�W�W�5��-�=�=�?�?�!�C��+;�'�-4�(.�&.�#�o�7�7�(>�(8�(8�$���	
���~�&�&�&��	D��K�K�4�0�0�1B�C�C�C�K�K��:�r�!�!r!Nc���|���}d}|jjD]}||rn�
td���|||jj|j|jj|j�}|dkrd}n\|rI	|jj|�|��r|}n1#t$rtd|z���wxYw|dkrd}n|dkrd}|sE|jj
D])}|jj|�|��rn�*td	���|dkrd
}n4	|jj||��}n#tj
$rd}YnwxYw||||fS)aA
        Analyze an enumerator and return the results.

        :Return:
            - the enumerator format ('period', 'parens', or 'rparen'),
            - the sequence used ('arabic', 'loweralpha', 'upperroman', etc.),
            - the text of the enumerator, stripped of formatting, and
            - the ordinal value of the enumerator ('a' -> 1, 'ii' -> 2, etc.;
              ``None`` is returned for invalid enumerator text).

        The enumerator format has already been determined by the regular
        expression match. If `expected_sequence` is given, that sequence is
        tried first. If not, we check for Roman numeral 1. This way,
        single-character Roman numerals (which are also alphabetical) can be
        matched. If no sequence has been matched, all sequences are checked in
        order.
        r�zenumerator format not matchedruzunknown enumerator sequence: %sr�r��Ir�zenumerator sequence not matchedruN)rr��formatsr)rr�r�sequenceregexpsr�KeyError�	sequences�
convertersr�InvalidRomanNumeralError)r2r�expected_sequencerr	rr�r
s        r"rzBody.parse_enumerator6s���$�O�O�%�%�	����i�'�	?�	?�F��� �
���
��=�>�>�>��� ���!5�f�!=�!C�#'�9�#7��#?�#C�"D�E���3�;�;��H�H�
�
	$�
.��9�,�->�?�E�E�d�K�K�1�0�H����
.�
.�
.�!�"C�$,�#-�.�.�.�
.�����S�[�[�#�H�H�
�S�[�[�#�H��	E� �I�/�
E�
E���9�,�X�6�<�<�T�B�B���E��"�"C�D�D�D��s�?�?��G�G�
�8�$�)�.�x�8��>�>�����1�
�
�
�����
�����x��w�.�.s�'B-�-C
�/E�E�Ec���|�dS	|j���}|j���n*#t$r|j���YdSwxYw|dd����sdS|�|dz||��}|rC|\}}	|�|��s|�|��rdSn#t$rYnwxYwdS)z�
        Check validity based on the ordinal value and the second line.

        Return true if the ordinal is valid and the second line is blank,
        indented, or starts with the next enumerator or an auto-enumerator.
        Nru)r^rr�rg�strip�make_enumeratorr��	TypeError)r2r
r	rr�result�next_enumerator�auto_enumerators        r"rzBody.is_enumerated_list_itemms,���?��4�	/��*�4�4�6�6�I�

��,�,�.�.�.�.��	�	�	�	���,�,�.�.�.��1�1�	����
��!��}�"�"�$�$�	��1��%�%�g��k�8�V�D�D���	�/5�,�O�_�
��(�(��9�9�� �+�+�O�<�<���1����
�
�
���
�����ts!�9�#A �A �#*C�
C�Cc��|dkrd}�n|dkrt|��}n�|�d��r+|dkrdSt|td��zdz
��}nS|�d��r,	t	j|��}n(#tj$rYdSwxYwtd	|z���|�d
��r|�	��}n<|�d��r|�
��}ntd	|z���|jj|}|j
|z|jzdz}|j
dz|jzdz}||fS)
z�
        Construct and return the next enumerated list item marker, and an
        auto-enumerator ("#" instead of the regular enumerator).

        Return ``None`` for invalid (out of range) ordinals.
        rur�r��Nr�rurz!unknown enumerator sequence: "%s"r�r�rF)�strrS�chrr�r�toRoman�
RomanErrorr)r�r�r�r�rr�r�)r2r
r	rr�rrrs        r"rzBody.make_enumerator�s����s�?�?��J�J�
��
!�
!��W���J�J�� � ��)�)�
.��R�<�<��4� ��3�s�8�8�!3�a�!7�8�8�
�
��"�"�7�+�+�
.� �!&��w�!7�!7�J�J���'� � � ��4�4� ����"�"E�$,�#-�.�.�.��"�"�7�+�+�
.�'�-�-�/�/�
�
��$�$�W�-�-�
.�'�-�-�/�/�
�
�!�"E�$,�#-�.�.�.��Y�)�&�1�
�%�,�z�9�J�<M�M� �!��$�+�c�1�J�4E�E��K����/�/s�7B�B�Bc��tj��}|xj|z
c_|�|��\}}||z
}|jjdz}|�|jj|d�|j���dz|d|���\}}|�	|��|s#|xj|�
d��z
c_g|gfS)zField list item.ruN�	FieldListr�z
Field list)r�
field_listrc�fieldr^r�r�rMrhrfr�)	r2rrnr�r%r&r�r�rs	         r"r�zBody.field_marker�s����%�'�'�
����z�!���"�j�j��/�/���|��e��
��#�/�!�3��'+�'=�'=�� �,�V�W�W�5��-�=�=�?�?�!�C��[�'�	(>�()�()�$���
	
���~�&�&�&��	?��K�K�4�0�0��>�>�>�K�K��:�r�!�!r!c�&�|�|��}|j���\}}|j���}|j�|�����\}}}}	t
j��}
||
_||
_	|�
||��\}}|
t
j|dg|�R�z
}
t
jd�
|��g|�R�}
|
|
z
}
|r|�|||
��|
|	fS)Nr�r�)�parse_field_markerr^rar�r�rrr&r@rmr��
field_name�
field_bodyr��parse_field_body)r2rr��src�srcliner�r�r�r�r��
field_node�
name_nodes�
name_messagesr*s              r"r&z
Body.field�s���&�&�u�-�-���)�=�=�?�?���W��#�3�3�5�5��
�
�
8�
8������
E�
E�	��6�;���[�]�]�
��
��!�
��$(�$4�$4�T�6�$B�$B�!�
�M��e�&�t�R�=�*�=�=�=�=�
��%�d�i�i��&9�&9�J�M�J�J�J�
��j� �
��	E��!�!�(�K��D�D�D��<�'�'r!c�x�|���dd�}|d|�d���}|S)z6Extract & return field name from a field marker match.ruN�:)r"�rfind)r2rr&s   r"r(zBody.parse_field_marker�s9�����
�
�a�b�b�!���'�u�{�{�3�'�'�'�(���r!c�6�|�|||���dS)Nr�)r�)r2r�r�rKs    r"r+zBody.parse_field_body�s#�����(��d��C�C�C�C�Cr!c��tj��}|j���\|_|_	|�|��\}}n�#t$r�}|j�	d|z��}|xj
|z
c_
|j�|�����\}	}
}}|�
|	|��}|xj
|z
c_
|s#|xj
|�d��z
c_
g|gfcYd}~Sd}~wwxYw|xj
|z
c_
||z
}|jjdz}
|�|jj|
d�|j���dz|d|���\}}|�|��|s#|xj
|�d��z
c_
g|gfS)�Option list item.zInvalid option list marker: %szOption listNru�
OptionListr�)r�option_listr^rar@rm�option_list_itemrr:r�rcr�rr�r�r�r�rMrhrf)r2rrnr��
optionlistr�r�r�r,r�r�r�r�r�rs               r"r�zBody.option_marker�s����&�(�(�
�
�
�
3�
3�
5�
5�	��	�J�O�
	&�%)�%:�%:�5�%A�%A�"�H�l�l���	&�	&�	&��-�%�%�&F�(-�'.�/�/�C��K�K�3��K�K��#�<�<�U�Y�Y�[�[�I�I�
�X�v�{�L��'�'��+�>�>�H��K�K�8�#�K�K��
D����t�4�4�]�C�C�C����z�2�%�%�%�%�%�%�%�����	&����	
���z�!����h��
��#�/�!�3��'+�'=�'=�� �,�V�W�W�5��-�=�=�?�?�!�C��\�'�	(>�()�()�$���
	
���~�&�&�&��	@��K�K�4�0�0��?�?�?�K�K��:�r�!�!s�A�
D�B-D�D�Dc���|j���}|�|��}|j�|�����\}}}}|s)|�|��t
jd���tj	dg|�R�}tj
d�|����}	tjd||	��}
|r|�
|||	���|
|fS)Nr�r�r�r�)r^rh�parse_option_markerr�rrfrrr�option_group�descriptionr�r9r�)r2rr��optionsr�r�r�r�r=r>r9s           r"r9zBody.option_list_item�s���#�3�3�5�5���*�*�5�1�1��
�
�
8�
8������
E�
E�	��6�;���	<��N�N�6�"�"�"��3�F�;�;�;��)�"�7�w�7�7�7���'��	�	�(�(;�(;�<�<�� �1�"�l�2=�?�?���	0����h�[�#.�
�
0�
0�
0���-�-r!c��g}|�������d��}|D�]}|���}d}|d�dd��}t|��dkr
||dd�<d}n�t|d��dkrx|d�d��r|d�d	��r|d�d
��r'|ddd�|ddd�g|dd�<d}t|��dkrY|d�d��r>|d
�d��r#d�|dd���g|dd�<dt|��cxkrdkr�nn�tj|��}|tj	|d|d��z
}t|��dkr&|tj
|d|d|���z
}|�|�����tdt|���d|�d����|S)z�
        Return a list of `node.option` and `node.option_argument` objects,
        parsed from an option marker match.

        :Exception: `MarkupError` for invalid option markers.
        z, rFr�=ruNrv�-z--�+r��<r�r�)�	delimiterz wrong number of option tokens (=z), should be 1 or 2: "�")
r"r�rIryr�rSr�rr��
option_string�option_argumentr}r)	r2r�optlist�
optionstrings�optionstring�tokensrE�firstoptr�s	         r"r<zBody.parse_option_markersj�������
�
�,�,�.�.�4�4�T�:�:�
�)�	:�	:�L�!�'�'�)�)�F��I��a�y���s�A�.�.�H��8�}�}�q� � �%��r��r�
��	�	��f�Q�i�.�.�1�$�$��q�	�,�,�S�1�1�%� &�q�	� 4� 4�T� :� :�%�!��)�.�.�s�3�3�%�
%�Q�i����m�V�A�Y�q�r�r�]�;��r��r�
��	��6�{�{�Q���F�1�I�$8�$8��$=�$=��(.�r�
�(;�(;�C�(@�(@��"�h�h�v�a�b�b�z�2�2�3��q�r�r�
��3�v�;�;�#�#�#�#�!�#�#�#�#�#���l�3�3���%�-�f�Q�i����C�C�C���v�;�;��?�?��e�3�F�1�I�v�a�y�>G�I�I�I�I�F����v�&�&�&�&�!�k�!�&�k�k�k�k�<�<�<�9�:�:�:��r!c��d�|j�����}|xjt	j||��z
c_g|gfS)Nr�)r�r^�get_text_blockrcr�
doctest_block)r2rrnr�r�s     r"r�zBody.doctest4sN���y�y��+�:�:�<�<�=�=��	
���u�*�4��6�6�6����:�r�!�!r!c��tj��}|xj|z
c_|j���}|�||��\}}}||z
}|xj|z
c_|sm|jjdz}	|�|jj|	d�|j�	��dz|dd���\}
}|�
|
��|s-|xj|j�d|dz���z
c_t|��r/|dj�
d|d_|�|��g|gfS)zFirst line of a line block.ruN�	LineBlockrr�z%Line block ends without a blank line.r�)rr�rcr^r��line_block_liner�r�rMrhrfr:r�ryr��nest_line_block_lines)r2rrnr�r�r�rmr�r�r�r�s           r"r�zBody.line_block<si��� �"�"�����u�����#�3�3�5�5��'+�';�';�E�6�'J�'J�$��h��
��
�����x�����	,��'�3�a�7�F�,0�,B�,B��$�0����9�#�1�A�A�C�C�a�G��K� �	-C�-"�-"�)�O�\�

�N�N�?�+�+�+��	��K�K�4�=�0�0�7��A�X�1���
�K�K��u�:�:�	.��Q�x��&�"#��a����&�&�u�-�-�-��:�r�!�!r!c��|j�|���d���\}}}}d�|��}|�||��\}}	tj|dg|�R�}
|j���dkr*t|�
d����dz
|
_|
|	|fS)z(Return one line element of a line_block.T��until_blankr�r�r�ru)r^r�rr�r�rrmrr�ryr"r�)r2rr�r�r�r�r�r��
text_nodesr�rms           r"rSzBody.line_block_lineVs����
�
8�
8������EI�9�K�K�	��6�;���y�y��"�"��#�/�/��f�=�=��
�H��z�$��0�Z�0�0�0���<��� � �C�'�'��e�k�k�!�n�n�-�-��1�D�K��X�|�+�+r!c���tdt|����D]4}t||dd���||dz
j||_�5|�|��dS)Nrur�)r�ryr�r��nest_line_block_segment)r2r�r�s   r"rTzBody.nest_line_block_linesbsj���1�c�%�j�j�)�)�	>�	>�E��u�U�|�X�t�4�4�<�&+�E�A�I�&6�&=��e��#���$�$�U�+�+�+�+�+r!c���d�|D��}t|��}g}tj��}|D]�}|j|kr|�|���#t|��r=|�|��|�|��tj��}|�|����t|��r*|�|��|�|��||dd�<dS)Nc��g|]	}|j��
Sr )r�)rK�items  r"�
<listcomp>z0Body.nest_line_block_segment.<locals>.<listcomp>is��1�1�1�4�4�;�1�1�1r!)�minrr�r�r}ryrZ)r2r��indents�least�	new_items�	new_blockr]s       r"rZzBody.nest_line_block_segmenths��1�1�5�1�1�1���G�����	��$�&�&�	��	'�	'�D��{�U�"�"�� � ��&�&�&�&��y�>�>�3��0�0��;�;�;��$�$�Y�/�/�/� %� 0� 2� 2�I�� � ��&�&�&�&��y�>�>�	(��(�(��3�3�3����Y�'�'�'���a�a�a���r!c�R�|�||||jtj��S)zTop border of a full table.)�	table_top�isolate_grid_tabler�GridTableParser�r2rrnr�s    r"r�zBody.grid_table_top{s*���~�~�e�W�j�"�5�)�9�;�;�	;r!c�R�|�||||jtj��S)zTop border of a simple table.)re�isolate_simple_tabler�SimpleTableParserrhs    r"r�zBody.simple_table_top�s*���~�~�e�W�j�"�7�)�;�=�=�	=r!c���|�||��\}}|xj|z
c_|sF|j�d|j���dz���}|xj|z
c_g|gfS)zTop border of a generic table.z Blank line required after table.rur�)�tablercr:r�r^r�)	r2rrnr��isolate_function�parser_classrBr�r,s	         r"rezBody.table_top�s���"&���,<�l�!K�!K���,����x�����	��-�'�'�2��'�7�7�9�9�!�;�(�=�=�C�
�K�K�3��K�K��:�r�!�!r!c��|��\}}}|r�	|��}|�|��}|j���t|��z
dz}|�||��}	|	g|z}
nV#t
j$rB}|�|d�|j	��|j
���|z}
Yd}~n
d}~wwxYw|}
|
|fS)zParse a table.rurF)r�N)r�r^r�ry�build_tabler�TableMarkupError�malformed_tabler�r	r�)r2rnror�r�r��parser�	tabledata�	tablelinermrB�errs            r"rmz
Body.table�s	��(8�(8�(:�(:�%��x���	 �	
N�%�����"�L�L��/�/�	�!�/�?�?�A�A�C��J�J�N� �!�	��(�(��I�>�>��!�7�X�-�����/�
N�
N�
N��/�/��s�x�x���7I�7I�7:�z�0�C�C�EM�N�����������
N���� �H���%�%s�A'A:�:C�	8C�Cc�*�g}d}	|j�d���}nY#tj$rG}|j\}}}|�|j�d||�����d}Yd}~nd}~wwxYw|���|�	|j
��t|d�����}tt|����D]b}||���||<||ddvr3d}|j�t|��|z
��||d�=n�c|j�|d��s�d}tt|��d	z
dd��D]Y}|j�||��r7|j�t|��|z
dz��||dzd�=n.�Z|�|�|����g||fStt|����D]Z}t||��|ks||ddvr/|�|�|����g||fcS�[|||fS)
NruT��
flush_left�Unexpected indentation.�r@rmrz+|r�rv)r^rOr�UnexpectedIndentationErrorr	r}r:r��
disconnect�pad_double_width�double_width_pad_charryrr�r��grid_table_top_patr�extendrs)	r2r�r�r�rwr,r-�widthr�s	         r"rfzBody.isolate_grid_table�s�������	��&�5�5��5�F�F�E�E���6�	�	�	�"%�(��E�3���O�O�D�M�/�/�0I�7:��0�J�J�
K�
K�
K��L�L�L�L�L�L�����		����
	������
���t�9�:�:�:��E�!�H�N�N�$�$�%�%���s�5�z�z�"�"�	�	�A��Q�x�~�~�'�'�E�!�H��Q�x��{�$�&�&� ���"�0�0��U���a��@�@�@��!�"�"�I���	'�
�&�,�,�U�2�Y�7�7�
	2��L��3�u�:�:��>�1�b�1�1�
2�
2���*�0�0��q��:�:���&�4�4�S��Z�Z�!�^�a�5G�H�H�H��a��c�d�d���E��
���� 4� 4�U� ;� ;�<�<�<��8�\�1�1��s�5�z�z�"�"�	2�	2�A��5��8�}�}��%�%��q��"��T�)A�)A����� 4� 4�U� ;� ;�<�<�<��8�\�1�1�1�1�*B��h��,�,s�"�A8�=A3�3A8c�^�|jj}|jj}t|��dz
}t||�����}|jj}d}d}|dz}||kr�||}	||	��}
|
r�t|	�����|kre|j�||z
��|�|||dz�d��}g|||kp||dz���fS|dz
}|}|dks#||ks||dz���s|}n�|dz
}||k��|r-d}
|j�||z
��|||dz�}n,d}
|j�||z
dz
��||d�}|�|d|
z��}g||
fS|j�||z
��|||dz�}|�	|j
��|g||kp||dz���fS)Nrurz5Bottom/header table border does not match top border.rvz$ or no blank line after table bottomr�zNo bottom table border found%s.)r^r�rMryr�simple_table_border_patrrrsrr�)r2r�r��limit�toplen�
pattern_match�found�found_atr�rmrr�r�extrar�s               r"rjzBody.isolate_simple_table�s����"�.���"�.���E�
�
�Q����U�5�\�'�'�)�)�*�*���4�:�
������A�I���5�j�j���8�D�!�M�$�'�'�E��
��t�z�z�|�|�$�$��.�.��&�0�0��U��;�;�;�#�3�3��e�A�a�C�i�(�+0� 1� 1�H��x��e��)M�5��1��:�;K�;K�;M�;M�7M�M�M���
�����A�:�:��e���5��1��:�3C�3C�3E�3E���C��
��F�A��5�j�j�"�
&�>���"�,�,�X��-=�>�>�>��e�H�Q�J�.�/������"�,�,�Q��Y��]�;�;�;��e�f�f�
���+�+��8�5�@�B�B�H��x�U��*�*���$�$�S�5�[�1�1�1��e�C��E�k�"��
���t�9�:�:�:��b�#��,�B�e�C��E�l�.@�.@�.B�.B�*B�B�Br!c�>�|�|jd��d�|��}d}|j���t|��z
dz}|r|d|zz
}|j�|tj	||��||z���}|gS)Nr�r�zMalformed table.rur�)
�replacer�r�r^r�ryr:r�rr�)r2r��detailr�r�r3�	startliner�s        r"rszBody.malformed_table�s���
�
�
�d�0�"�5�5�5��y�y�����$���&�6�6�8�8�3�u�:�:�E��I�	��	%��t�f�}�$�G��
�#�#�G�U�-@��t�-L�-L�)2�6�)9�$�;�;���w�r!c��|\}}}tj��}|dkr|dxxdgz
cc<n|r|dxxdgz
cc<tjt|�����}	||	z
}|D]-}
tj|
���}|rd|jd<|dz}|	|z
}	�.|r6tj��}|	|z
}	|D]}
||�|
|��z
}�tj��}|	|z
}	|D]}
||�|
|��z
}�|S)	Nrv�classeszcolwidths-autozcolwidths-given)�cols)�colwidthru�stub)	rrm�tgroupry�colspec�
attributes�thead�build_table_row�tbody)r2rurv�stub_columns�widths�	colwidths�headrows�bodyrowsrmr�r�r�r��rowr�s               r"rqzBody.build_tablesg��(1�%�	�8�X���
�
���V����)����!1� 2�2�����
�	4��)����!2� 3�3������3�y�>�>�2�2�2��
����!�	�	�H��m�X�6�6�6�G��
"�-.��"�6�*���!���g��F�F��	>��K�M�M�E��e�O�F��
>�
>����-�-�c�9�=�=�=�����
�
���%����	:�	:�C��T�)�)�#�y�9�9�9�E�E��r!c��tj��}|D]b}|��|\}}}}i}	|r||	d<|r||	d<tjdi|	��}
||
z
}d�|��r|�|||z|
����c|S)N�morerows�morecolsr�r�r )rr��entryr�r�)r2�rowdatarvr��cellr�r�r��	cellblockr�r�s           r"r�zBody.build_table_rows����i�k�k���
	.�
	.�D��|��48�1�H�h��	��J��
2�)1�
�:�&��
2�)1�
�:�&��K�-�-�*�-�-�E��5�L�C��w�w�y�!�!�
.��!�!�)�)�F�:J�',�"�.�.�.���
r!a?
                            (
                              _               # anonymous target
                            |               # *OR*
                              (?!_)           # no underscore at the beginning
                              (?P<quote>`?)   # optional open quote
                              (?![ `])        # first char. not space or
                                              # backquote
                              (?P<name>       # reference name
                                .+?
                              )
                              %(non_whitespace_escape_before)s
                              (?P=quote)      # close quote if open quote used
                            )
                            (?<!(?<!\x00):) # no unescaped colon at end
                            %(non_whitespace_escape_before)s
                            [ ]?            # optional space
                            :               # end of reference name
                            ([ ]+|$)        # followed by whitespace
                            a�
                               (
                                 (?P<simple>%(simplename)s)_
                               |                  # *OR*
                                 `                  # open backquote
                                 (?![ ])            # not space
                                 (?P<phrase>.+?)    # hyperlink phrase
                                 %(non_whitespace_escape_before)s
                                 `_                 # close backquote,
                                                    # reference mark
                               )
                               $                  # end of string
                               a�
                                  (
                                    (?![ ])          # first char. not space
                                    (?P<name>.+?)    # substitution text
                                    %(non_whitespace_escape_before)s
                                    \|               # close delimiter
                                  )
                                  ([ ]+|$)           # followed by whitespace
                                  )r�rW�substitutionc��|j���\}}|j�|�����\}}}}|�d��}t|��}	t
jd�|����}
||
_	||
_
|	ddkrG|	dd�}	d|
d<|	r|
d�|	��|j�
|
��nu|	dkr"d}	d|
d<|j�|
��nM|
t
jd|��z
}
|
d�|	��|j�|
��|	r|j�|
|
��n|j�|
|
��|r|�|||
�	��|
g|fS)
Nrur�rrurvr�rwr�r�)r^rar�rr"r�r�footnoter�r@rmr}r9�note_autofootnote�note_symbol_footnoter��
note_footnoterZr1r�)r2rr,r-r�r�r�r�r�r�r�s           r"r�z
Body.footnote]s����)�=�=�?�?���W�
�
�
8�
8������
E�
E�	��6�6�<����A�����e�$�$���>�$�)�)�H�"5�"5�6�6�������
���7�c�>�>�����8�D� �H�V���
/���!�(�(��.�.�.��M�+�+�H�5�5�5�5�
�S�[�[��D�"�H�V���M�.�.�x�8�8�8�8����B��.�.�.�H��W��$�$�T�*�*�*��M�'�'��1�1�1��	5��M�.�.�x��B�B�B�B��M� � ��8�4�4�4��	L����h�V�(��K�K�K��z�<�'�'r!c�\�|j���\}}|j�|�����\}}}}|�d��}t|��}	t
jd�|����}
||
_	||
_
|
t
jd|��z
}
|
d�|	��|j
�|
��|j
�|
|
��|r|�|||
���|
g|fS)Nrur�r�r�r�)r^rar�rr"r�r�citationr�r@rmr�r}r9�
note_citationrZr�)r2rr,r-r�r�r�r�r�r�r�s           r"r�z
Body.citation|s���)�=�=�?�?���W�
�
�
8�
8������
E�
E�	��6�6�<����A�����e�$�$���>�$�)�)�H�"5�"5�6�6�������
��E�K��E�*�*�*����� � ��&�&�&��
�#�#�H�-�-�-��
�*�*�8�X�>�>�>��	L����h�V�(��K�K�K��z�<�'�'r!c���|jjj}|j���}|j�|���dd���\}}}}|jd|����d�|��z}d�|D��}|d}	d}
	|�	|	��}|rn0|
dz
}
	|	||
z
}	n#t$rtd���wxYw�H|d|
�=|dd	z|���t|	��z
dz
d��
��|d<|�||||�d
����}|g|fS)NTF)rW�strip_indentr�c�,�g|]}t|����Sr �r�rKrms  r"r^z)Body.hyperlink_target.<locals>.<listcomp>�� ��5�5�5�t��T�"�"�5�5�5r!rruzmalformed hyperlink target.rFr�)�explicitrr�r^r�r�rrr�rr|rryr�make_targetr")
r2rr�r�r�r�r�r��	blocktextrA�
blockindex�targetmatchr�s
             r"�hyperlink_targetzBody.hyperlink_target�s����-�(�/���#�3�3�5�5��
�
�
8�
8������$�U�9�D�D�	������L��%�)�)�+�+��.����5�1A�1A�A�	�5�5�u�5�5�5����(���
�	A�!�-�-��0�0�K��
���!�O�J�
A��5��,�,�����
A�
A�
A�!�"?�@�@�@�
A����	A�
�+�:�+���!�H�s�N�K�O�O�$5�$5�c�'�l�l�$B�1�$D�$E�$E�F�L�L�N�N��a���!�!�%��F�"-�"3�"3�F�";�";�=�=���x��%�%s�C�C1c�n�|�|||��\}}|dkr_tj|dt|�����}||_|�|d||��|j�|��|S|dkr/tj|d��}|�||||��|S|S)NrEr�rDrO)�parse_targetrr�r�rT�
add_targetr9rY)r2r��
block_textr��target_name�target_typer�r�s        r"r�zBody.make_target�s��� �-�-�e�Z��H�H���T��)�#�#��\�*�b�.��:N�:N�O�O�O�F�-1�F�*��O�O�K��V�V�<�<�<��M�.�.�v�6�6�6��M�
�H�
$�
$��\�*�b�1�1�F��O�O�K��v�v�>�>�>��M��Kr!c�P�|r`|d���dd�dkr:d�d�|D����}|�|��}|rd|fStd�|����}d�d�|D����}d|fS)	z�
        Determine the type of reference of a target.

        :Return: A 2-tuple, one of:

            - 'refname' and the indirect reference name
            - 'refuri' and the URI
            - 'malformed' and a system_message node
        r�Nr<rFc3�>K�|]}|���V��dSr/)rr�s  r"rLz$Body.parse_target.<locals>.<genexpr>�s*���� @� @�$������ @� @� @� @� @� @r!rEc3�~K�|]8}d�t|�������V��9dSrH)r�rrIrJs  r"rLz$Body.parse_target.<locals>.<genexpr>�sT����4�4�!%� �W�W�X�d�^�^�%9�%9�%;�%;�<�<�4�4�4�4�4�4r!rO)rr��is_referencer)r2r�r�r�rWrE�	ref_partss       r"r�zBody.parse_target�s����	*�U�2�Y�_�_�&�&�r�s�s�+�s�2�2���� @� @�%� @� @� @�@�@�I��'�'�	�2�2�G��
*� �'�)�)�,�S�X�X�e�_�_�=�=�	��H�H�4�4�)2�4�4�4�4�4�	���"�"r!c���|jjj�t	|����}|sdSt|�d��p|�d����S)N�simple�phrase)r�rrWrrrr")r2rWrs   r"r�zBody.is_reference�sb���
�&�0�6�6�%�i�0�0�2�2���	��4�����H�-�-�F����X�1F�1F�G�G�Gr!c��||_|r�tt|����}|d�|��|r4|j�|��}|r||d<nt
d|z���|j�||j	��dS|r||d<d|d<|j�
|��dS)Nr�rOzproblem with URI: %rrurR)rmr�rr}r?rUr	r9rZrc�note_anonymous_target)r2�
targetnamerOr�r�r�r�s       r"r�zBody.add_target�s�������	8�!�(�:�"6�"6�7�7�D��7�O�"�"�4�(�(�(��
L��l�-�-�f�5�5���L�'*�F�8�$�$�*�+A�F�+J�K�K�K��M�.�.�v�t�{�C�C�C�C�C��
*�#)��x� �"#�F�;���M�/�/��7�7�7�7�7r!c	��|jjj}|j���\}}|j�|���d���\}}}}|jd|����d�|��z}	|�	��t|d�����}
d}	|�|
��}|rnR|dz
}	|
dzt||�
����z}
n#t$rtd���wxYw�j|d|�=|���t!|
��z
dz
}
|d�
��dz|
d	�|d<|ds|d=|dz
}|rJ|d	�
��s0|���|r|d	�
���0|�d
��}t'j|	��}||_||_|s9|j�d|zt'j|	|	��||���}|g|fS|d�
��|d<|d
�t'j|����|�|||d|���\}}d}|dd�D]U}t;|t&j��s4t;|t&j��s|xj ||z
c_ ||=�P|dz
}�V|�!t&j"��D]�}|�#|��rzt'jd|�$�������}|j�%d|j&z|t'j|	|	��||���}|g|fcS��t!|��dkr9|j�d|zt'j|	|	��||���}|g|fS|j'�(|||j ��|g|fS)NF�r�r�rTrurFz"malformed substitution definition.r�r�z.Substitution definition "%s" missing contents.r|r��SubstitutionDefr�r�z6Substitution definition contains illegal element <%s>:z.Substitution definition "%s" empty or invalid.))r�rr�r^rar�rrr�r~rr�rrr|rryr{r"r�substitution_definitionr@rmr:r�r�r}rr�r��Inlineryrc�findall�Element�*disallowed_inside_substitution_definitions�pformatr��tagnamer9�note_substitution_def)r2rr�r,r-r�r�r�r�r�rAr��subdefmatchr��subname�substitution_noder,�new_abs_offsetr�rKr�s                     r"�substitution_defzBody.substitution_def�s����-�(�5���)�=�=�?�?���W�
�
�
8�
8������FK�9�M�M�	������\�,�5�9�9�;�;�,�/�$�)�)�E�2B�2B�B�	�
�������e�A�h�o�o�/�/�0�0���
�		H�!�-�-��0�0�K��
���!�O�J�
H�!�C�-�+�.3�J�.?�.E�.E�.G�.G�+I�+I�I�����
H�
H�
H�!�"F�G�G�G�
H����		H�
�+�:�+�����!�!�#�g�,�,�.�q�0���!�H�N�N�$�$�s�*�E�"�H�5��a���Q�x�	��a���a�K�F��	�E�"�I�O�O�-�-�	��I�I�K�K�K��	�E�"�I�O�O�-�-�	��#�#�F�+�+��!�9�)�D�D��#&�� �!(����	'��-�'�'�@�7�J��#�I�y�9�9���(�*�*�C��5�,�&�&���8�>�>�#�#��a���'�"�)�)��+�G�4�4�	6�	6�	6�'+�'=�'=��&�/@�-�L�(>�(J�(J�$���
��%�a�a�a�(�	�	�D��t�U�\�2�2�
�!�$��
�3�3�
����0��3�3���%�a�(�(��Q����%�-�-�e�m�<�<�	+�	+�D��>�>�t�D�D�
+��-�b�$�,�,�.�.�2G�2G�2I�2I�J�J���m�)�)�L��l�#��U�0��I�F�F��W�	*�.�.��
�u�l�*�*�*�*�
+�� �!�!�Q�&�&��-�'�'�B�W�L��%�i��;�;��7�(�,�,�C��5�,�&�&��
�+�+��w���	5�	5�	5�!�"�L�0�0s�4-D"�"D<c���|ds^t|tj��r|�d��s/t|tj��r|�d��rdSdS)N�idsrRrvTF)r�rrW�getr{)r2rKs  r"r�z/Body.disallowed_inside_substitution_definitions)sk����K�	��$���0�0�	�59�X�X�k�5J�5J�	��$�� 8�9�9�	�>B�h�h�v�>N�>N�	��4��5r!c��|�d��}tj||jj|j��\}}|xj|z
c_|r|�||||��S|�|��S)z?Returns a 2-tuple: list of nodes, and a "blank finish" boolean.ru)	r"r�	directiverHr;r9rc�
run_directive�unknown_directive)r2r�option_presets�	type_name�directive_classr�s      r"r�zBody.directive1s����K�K��N�N�	�$.�$8��t�y�)�4�=�%:�%:�!������x�����	5��%�%���	�>�C�C�
C��)�)�)�4�4�4r!c���t|ttf��rddlm}||��}|j���}|jj}|j�|�	��d���\}}	}
}d�
|jj||jjdz���}	|�||
||��\}
}}}nk#t$r^}|j�d|�dd�
|j���d	�t#j||��|�
��}|g|fcYd}~Sd}~wwxYw|||
|||||||j�	�	}	|���}nh#t(jjj$rL}|j�|j|j|�
��}|t#j||��z
}|g}Yd}~nd}~wwxYwt|t6��s
Jd|z���t9t;|����D];}t||t"j��sJd
|�d|�d||������<||p|j���fS)a�
        Parse a directive then run its directive function.

        Parameters:

        - `directive`: The class implementing the directive.  Must be
          a subclass of `rst.Directive`.

        - `match`: A regular expression match object which matched the first
          line of the directive.

        - `type_name`: The directive name, as used in the source text.

        - `option_presets`: A dictionary of preset options, defaults for the
          directive options.  Currently, only an "alt" option is passed by
          substitution definitions (value: the substitution name), which may
          be used by an embedded image directive.

        Returns a 2-tuple: list of nodes, and a "blank finish" boolean.
        r)�convert_directive_function)�	strip_topr�ruz
Error in "z
" directive:
rFrjr�Nz+Directive "%s" must return a list of nodes.zDirective "z"" returned non-Node object (index z): ) r�rr�docutils.parsers.rstr�r^r�r�r�rr�rM�parse_directive_blockrr:r�r	rr�rL�docutils�parsers�rst�DirectiveError�system_messager�r,�listr�ry�Node�is_next_line_blank)r2r�rr�r�r�r��initial_line_offsetr�r�r�r�r��	argumentsr?�content�content_offsetr�r��directive_instancer�msg_noder�s                       r"r�zBody.run_directive=s��*�i�,�
�!;�<�<�	>�G�G�G�G�G�G�2�2�9�=�=�I��#�3�3�5�5��"�0�<��
�
�
8�
8������CD�9�F�F�	��6�;���Y�Y�t�1�=��$�"4�"@�1�"D�D� F�G�G�
�		)��*�*�8�[�+4�n�F�F�
8�I�w������	)�	)�	)��M�'�'�'�3<�9�9�36�8�8�F�K�3H�3H�3H�3H�J��#�J�
�;�;�&�(�J�J�E��7�L�(�(�(�(�(�(�(�����	)����'�Y��y�'�7�F��J��d�.@�B�B��	 �'�+�+�-�-�F�F����#�2�	 �	 �	 ��}�3�3�E�K���9?�4�A�A�H���+�J�
�C�C�C�H��Z�F�F�F�F�F�F�����		 ����
�&�$�'�'�	I�	I�<�y�H�	I�	I�'��s�6�{�{�#�#�	1�	1�A��f�Q�i���4�4�
1�
1�
1� �y�y�!�!�!�V�A�Y�Y�0�
1�
1�4�
1���G�� 2� E� E� G� G�I�	Is8�;C�
E�#AD<�6E�<E�E2�2G�AG�Gc��|j}|j}|r3|d���s|���|dz
}|rJ|d���s0|���|r|d����0|r`|js	|js|rPt|��D]\}}|���sn�|dz
}|d|�}	||dzd�}
||zdz}n|}
|}g}	|r|�|||	��\}}	ni}|	r|js|js|	||d�z}
|}g}	|
rO|
d���s5|
���|dz
}|
r|
d����5|js|jr|�	||	��}
ng}
|
r|std���|
||
|fS)Nrrur�zno content permitted)�option_spec�has_contentr�
trim_start�trim_end�required_arguments�optional_arguments�	enumerate�parse_directive_options�parse_directive_argumentsr)r2r�r�r�r�r�r�r�rm�	arg_blockr�r�r?r�s              r"r�zBody.parse_directive_blockysq���+���+���	�H�Q�K�-�-�/�/�	����!�!�!��1��K��	 �x��|�1�1�3�3�	 ��������	 �x��|�1�1�3�3�	 ��	��5�	�%�8�	�'�	�%�X�.�.�
�
���4��z�z�|�|���E���Q��� ��!���I��q��s�t�t�n�G�(�1�_�q�0�N�N��G�(�N��I��	�!%�!=�!=���Y�"8�"8��G�Y�Y��G��	�i�:�	�!*�!=�	��(�1�2�2�,�.�G�(�N��I��	 �g�a�j�.�.�0�0�	 ���� � � ��a��N��	 �g�a�j�.�.�0�0�	 ��'�	�9�+G�	��6�6��9�&�&�I�I��I��	6�;�	6��4�5�5�5��'�7�N�:�:r!c�Z�|���}t|��D]@\}}tjtjd|��r||d�}|d|�}n�Ag}|r@|�||��\}}	|r|�|	��nt|	���||fS)Nr�)	r�rr�rrXr�parse_extension_optionsr1r)
r2r�r�rr?r�rm�	opt_block�successr�s
          r"rzBody.parse_directive_options�s��� �%�%�'�'�� ��+�+�	�	�G�A�t��x��
�n�5�t�<�<�
�%�a�b�b�M�	�%�b�q�b�M�	���
�
�I��	(� �8�8��9B�D�D�M�G�T��
(����t�$�$�$�$�!�$�'�'�'��	�!�!r!c��|j}|j}d�|��}|���}t	|��|kr"t|�dt	|���d����t	|��||zkrJ|jr|�d||zdz
��}n&td||z�dt	|���d����|S)Nr�z argument(s) required, z	 suppliedruzmaximum z argument(s) allowed, )rrr�rIryr�final_argument_whitespace)r2r�r�required�optional�arg_textr�s       r"rzBody.parse_directive_arguments�s����/���/���9�9�Y�'�'���N�N�$�$�	��y�>�>�H�$�$��!)���3�y�>�>�>�>�;�<�<�
<�
��^�^�h��1�
1�
1��2�
=�$�N�N�4��H�1D�q�1H�I�I�	�	�!�k��(�*�*�*�C�	�N�N�N�N�<�=�=�=��r!c��tj��}|�|d|dd���\}}|t|��krdS	t	j||��}n�#t$r}dd|jdzfcYd}~Sd}~wttf$r)}ddd	�
|j��zfcYd}~Sd}~wtj$r)}dd
d	�
|j��zfcYd}~Sd}~wwxYw|rd|fSdS)
a�
        Parse `datalines` for a field list containing extension options
        matching `option_spec`.

        :Parameters:
            - `option_spec`: a mapping of option name to conversion
              function, which should raise an exception on bad input.
            - `datalines`: a list of input strings.

        :Return:
            - Success value, 1 or 0.
            - An option dictionary on success, an error string on failure.
        r�ExtensionOptionsT)r[r�)rzinvalid option blockzunknown option: "%s"Nzinvalid option value: %srFzinvalid option data: %sru)rzoption data incompletely parsed)rr%r�ryr�extract_extension_optionsrr	r�rr��ExtensionOptionError)r2r��	datalinesrKrr�r?r�s        r"rzBody.parse_extension_options�se����!�!��'+�'=�'=���D�0B��(>�(!�(!�$����S��^�^�+�+�,�,�	H��5�d�K�H�H�G�G���	>�	>�	>��,�v�{�1�~�=�=�=�=�=�=�=�=������I�&�	I�	I�	I��0�3�8�8�F�K�3H�3H�H�H�H�H�H�H�H�H������)�	H�	H�	H��/�#�(�(�6�;�2G�2G�G�G�G�G�G�G�G�G�����	H�����	8��g�:��7�7sB�A�
C1�'A>�8C1�>C1�B6�0C1�6C1�C,�&C1�,C1c��|j���}|j�dd���\}}}}d�|��}|j�d|zt
j||��|���}|g|fS)NrFr�r�zUnknown directive type "%s".r�)r^r�r�r�r:r�rr�)	r2r�r�r�r�r�r�r�r�s	         r"r�zBody.unknown_directive�s����#�3�3�5�5��
�
�
8�
8���
8�
O�
O�	��6�6�<��y�y��"�"���
�#�#�$B�Y�$N�$)�$7��d�$C�$C�)/�$�1�1���w��$�$r!c��|j���r�|j|���d�}|���stj��gdfS|�d��r"|jj	�
��gdfS|j�|�����\}}}}|rJ|d���s0|���|r|d����0d�
|��}tj||��g|fS)NTzend of inclusion from "r�r�)r^r�rrrr�commentr�r9�include_logr{r�r�r�)r2r�first_comment_liner�r�r�r�r�s        r"rzBody.comment�s7����0�0�2�2�	 �!&��e�i�i�k�k�l�l�!;��%�+�+�-�-�
/��
���(�$�.�.�!�,�,�-F�G�G�
 ��
�)�-�-�/�/�/��4�x��
�
�
8�
8������
E�
E�	��6�6�<��	 �x��|�1�1�3�3�	 ��������	 �x��|�1�1�3�3�	 ��y�y��"�"���
�d�D�)�)�*�L�8�8r!a�
                      \.\.[ ]+          # explicit markup start
                      \[
                      (                 # footnote label:
                          [0-9]+          # manually numbered footnote
                        |               # *OR*
                          \#              # anonymous auto-numbered footnote
                        |               # *OR*
                          \#%s            # auto-number ed?) footnote label
                        |               # *OR*
                          \*              # auto-symbol footnote
                      )
                      \]
                      ([ ]+|$)          # whitespace or end of line
                      z�
                      \.\.[ ]+          # explicit markup start
                      \[(%s)\]          # citation label
                      ([ ]+|$)          # whitespace or end of line
                      z�
                      \.\.[ ]+          # explicit markup start
                      _                 # target indicator
                      (?![ ]|$)         # first char. not space or EOL
                      z�
                      \.\.[ ]+          # explicit markup start
                      \|                # substitution indicator
                      (?![ ]|$)         # first char. not space or EOL
                      aK
                      \.\.[ ]+          # explicit markup start
                      (%s)              # directive name
                      [ ]?              # optional space
                      ::                # directive delimiter
                      ([ ]+|$)          # whitespace or end of line
                      c��|�|��\}}|xj|z
c_|�|��g|gfS�z3Footnotes, hyperlink targets, directives, comments.)�explicit_constructrc�
explicit_list�r2rrnr�rBr�s      r"r�zBody.explicit_markup1	sK��!%�!8�!8��!?�!?���,����x�������<�(�(�(��:�r�!�!r!c��g}|jjD]�\}}|�|j��}|r�	|||��cS#t$rm}|j���}d�|j��}|�	|j
�||�����Yd}~n	d}~wwxYw��|�|��\}	}
|	|z|
fS)z>Determine which explicit construct this is, parse & return it.rFr�N)
r��
constructsrrrr^r�r�r	r}r:r�r)r2r�errorsrr��expmatchr�r�r3rBr�s           r"rzBody.explicit_construct8	s�����#�}�7�		�		�O�F�G��}�}�U�\�2�2�H��
��!�6�$��1�1�1�1�1��"����!�/�?�?�A�A�F�!�h�h�u�z�2�2�G��M�M�$�-�"7�"7��f�"7�"M�"M�N�N�N��E�E�E�E�E�����	����
�"&���e�!4�!4���,��&� �,�.�.s�?�
B6�	A"B1�1B6c�N�|jjdz}|�|jj|d�|j���dz|jd||jj���\}}|�|��|s%|xj|�d��z
c_dSdS)z�
        Create a nested state machine for a series of explicit markup
        constructs (including anonymous hyperlink targets).
        ruN�Explicit)rNrKr[r�rEzExplicit markup)	r^r�r�rMrhrcrErfr�)r2r�r�rs    r"rzBody.explicit_listH	s���
�#�/�!�3��'+�'=�'=�� �,�V�W�W�5��-�=�=�?�?�!�C��;�j�'��-�:�(>�(<�(<�$���	
���~�&�&�&��	D��K�K�4�0�0�1B�C�C�C�K�K�K�K�	D�	Dr!c��|�|��\}}|xj|z
c_|�|��g|gfS�zAnonymous hyperlink targets.)�anonymous_targetrcrrs      r"rRzBody.anonymousX	sK��!%�!6�!6�u�!=�!=���,����x�������<�(�(�(��:�r�!�!r!c�Z�|j���}|j�|���d���\}}}}|jd|����d�|��z}d�|D��}|�|||d��}|g|fS)NTrVr�c�,�g|]}t|����Sr r�r�s  r"r^z)Body.anonymous_target.<locals>.<listcomp>e	r�r!r�)r^r�r�rrr�r�)	r2rr�r�r�r�r�r�r�s	         r"r&zBody.anonymous_target_	s����#�3�3�5�5��
�
�
8�
8������EI�9�K�K�	������L��%�)�)�+�+��.����5�1A�1A�A�	�5�5�u�5�5�5���!�!�%��F�B�?�?���x��%�%r!c�d�|jjr|jgdgfS|j���dkrt	jd���t
|j�����dkrW|j�d|j�	�����}|xj
|z
c_
t	jd���|jj}|j�dtj||��|j�	�����}|xj
|z
c_
g|gfS)z,Section title overline or transition marker.�Line�::r��zeUnexpected possible title overline or transition.
Treating it as ordinary text because it's so short.r�z'Unexpected section title or transition.)r^rErrrrryr:rr�rcrmrkrr�)r2rrnr�r,r�s      r"rmz	Body.linei	s.����*�	&��L�>�6�2�-�-�
�\�
�
�
!�
!�T�
)�
)��3�F�;�;�;�
���#�#�%�%�
&�
&��
*�
*��-�$�$�F��'�7�7�9�9�%�;�;�C�
�K�K�3��K�K��3�F�;�;�;��*�/�I��-�&�&�;��%�i��;�;��)�9�9�;�;�'�=�=�C�
�K�K�3��K�K��z�2�%�%r!c��|jgdgfS)z%Titles, definition lists, paragraphs.ry�rrhs    r"r�z	Body.text	s����~�v�r�)�)r!r/)r�r)rN)brrrr5r�TableParserr�r-r�r�keysrr�sequencepatsr�r�r�r�rr�rrr	r�r�r��simple_table_top_patr��patsr�escaper�r�r�initial_transitionsr�r�r�r�r�r�r�r�r�rrrr�r&r(r+r�r9r<r�r�rSrTrZr�r�rermrfrjrsrqr�r�r�rFrr�r�r�r�r�r�r�r�r�r�r�r�rrrr�rr�rr�rrrRr&rmr�r r!r"rXrX2s��������(�3�I��=��6�8�8�D�.��F�#�c���C�C�C��F�"�S��r�B�B�B��F�"�S��r�B�B�B�D�D�D�O��?�'�'�)�)�D�L�2�2�2�D�N�#+�'.�'.�'3�'3�	5�5�D��
"%�%7�%7�%7�%*�_�	6�6�D�O��D���N�1�1��)3������)�C�/�*1�*1���X�&�&�$���$5�6�6��6�%�2�:�n�5�5��,�(�b�j��4�4��?�
�D�4�.�D�	���D��M�$�D���*�D���)�+/�+<�=�D��L�5��<�D��O�<�t�C�D��N�;�d�B�D���;�d�B�D��O�2�T�9�D��N��,�G�G����f�f�i�b�i���� 7� >�?�?�?��6�l�l�I�B�I�d�o�f�&=�&D�E�E�E�E�G��V���
4�C�d�J�N�@�4�G�!�#�.�2�*�"�0�4�7����H���'�'�'����2%�"�*�%F�G�G��!4�!4�!4�F � � �(���"�"�"�(&�&�&�!"�!"�!"�F5/�5/�5/�5/�n���:#0�#0�#0�J"�"�"�"(�(�(�"���D�D�D�"�"�"�@.�.�.�"'�'�'�R"�"�"�"�"�"�4
,�
,�
,�,�,�,����&;�;�;�=�=�=�
"�
"�
"�&�&�&�$$-�$-�$-�L)C�)C�)C�V	�	�	�	�����4���$�v�x�x�H�F������ �&#'�$�w�-�-�'0�&24��'=�=�(�B�J� #�&*�T�'�]�]� 3�57�J�@�@�"�r�z�#&�)-��W�
�
�#6�#%�*�	.�	.�E+0�+0�+0�H��Z(�(�(�>(�(�(�"&�&�&�2
�
�
�#�#�#�(H�H�H�8�8�8�$E1�E1�E1�N���
5�
5�
5�:I�:I�:I�x,;�,;�,;�\"�"�"�$���"8�8�8�B%�%�%�9�9�9�"��2�:��$�.�/�13�
�<�<�=� ��2�:��$�.�	/�13�
�	<�<�=���2�:���:�	'�'�(���2�:���:�	'�'�(���2�:��$�.�
/�13�
�
<�<�=�G*>�H��X"�"�"�/�/�/� D�D�D� "�"�"�&�&�&�&�&�&�,*�*�*�*�*r!rXc��eZdZdZej���Zded<d�ejD��Ze�dd��d�Z	d�Z
d	S)
�RFC2822Bodyz�
    RFC2822 headers are only valid as the first constructs in documents.  As
    soon as anything else appears, the `Body` state should take over.
    z[!-9;-~]+:( +|$)�rfc2822c��g|]}|df��S)rXr )rKr�s  r"r^zRFC2822Body.<listcomp>�	s2��A�A�A�#�!�&�>�A�A�Ar!r�)r8rXc��tjdg���}|xj|z
c_|�|��\}}||z
}|jjdz}|�|jj|d�|j���dz|d|���\}}|�	|��|s#|xj|�
d��z
c_g|gfS)�RFC2822-style field list item.r8)r�ruN�RFC2822Listr�zRFC2822-style field list)rr%rc�
rfc2822_fieldr^r�r�rMrhrfr�)	r2rrnr��	fieldlistr&r�r�rs	         r"r8zRFC2822Body.rfc2822�	s����$�i�[�9�9�9�	����y� ���"�0�0��7�7���|��U��	��#�/�!�3��'+�'=�'=�� �,�V�W�W�5��-�=�=�?�?�!�C��M�'�	(>�()�()�$���
	
���~�&�&�&��	.��K�K�4�0�0�,�.�.�
.�K�K��:�r�!�!r!c��|jd|j�d���}|j�|���d���\}}}}tj��}|tj||��z
}tjd�	|����}||z
}|r|�
|||���||fS)Nr2TrVr�r�)r�findr^r�rrr&r)r*r�r�)	r2rr�r�r�r�r��	fieldnode�	fieldbodys	         r"r=zRFC2822Body.rfc2822_field�	s����|�3�U�\�.�.�s�3�3�3�4��
�
�
8�
8������EI�9�K�K�	��6�;���K�M�M�	��U�%�d�D�1�1�1�	��$�T�Y�Y�x�%8�%8�9�9�	��Y��	��	.����h�[�#,�
�
.�
.�
.��,�&�&r!N)rrrr5rXrr�r5�insertr8r=r r!r"r7r7�	s���������
�}�!�!�#�#�H�-�H�Y��A�A�'+�'?�A�A�A�����r�#6�7�7�7�"�"�"�$'�'�'�'�'r!r7c�N�eZdZdZdd�ZeZeZeZeZeZ	eZ
eZeZeZ
eZeZeZeZdS)�SpecializedBodya�
    Superclass for second and subsequent compound element members.  Compound
    elements are lists and list-like constructs.

    All transition methods are disabled (redefined as `invalid_input`).
    Override individual methods in subclasses to re-enable.

    For example, once an initial bullet list item, say, is recognized, the
    `BulletList` subclass takes over, with a "bullet_list" node as its
    container.  Upon encountering the initial bullet list item, `Body.bullet`
    calls its ``self.nested_list_parse`` (`RSTState.nested_list_parse`), which
    starts up a nested parsing session with `BulletList` as the initial state.
    Only the ``bullet`` transition method is enabled in `BulletList`; as long
    as only bullet list items are encountered, they are parsed and inserted
    into the container.  The first construct which is *not* a bullet list item
    triggers the `invalid_input` method, which ends the nested parse and
    closes the container.  `BulletList` needs to recognize input that is
    invalid in the context of a bullet list, which means everything *other
    than* bullet list items, so it inherits the transition list created in
    `Body`.
    Nc�B�|j���t��z8Not a compound element member. Abort this state machine.)r^r�rgrhs    r"�
invalid_inputzSpecializedBody.invalid_input�	s����(�(�*�*�*��r!�NNN)rrrr5rHr�r�r�r�r�r�r�r�r�r�rRrmr�r r!r"rErE�	sp��������,����
�F�
�F��J� �L�!�M��G��J�"�N�$��#�O��I��D��D�D�Dr!rEc��eZdZdZd�ZdS)r�z-Second and subsequent bullet_list list_items.c���|jd|jdkr|���|�|�����\}}|xj|z
c_||_g|gfS)r�rr�)rrcrHr�rr�)r2rrnr�r�r�s      r"r�zBulletList.bullet�	so���<��?�d�k�(�3�3�3���� � � �!%����	�	���!<�!<���,����x����(����:�r�!�!r!N)rrrr5r�r r!r"r�r��	s)������7�7�"�"�"�"�"r!r�c��eZdZdZd�ZdS)�DefinitionListz,Second and subsequent definition_list_items.c��|jgdgfS)zDefinition lists.�
Definitionr.rhs    r"r�zDefinitionList.text�	s����~�|�R�/�/r!N)rrrr5r�r r!r"rMrM�	s)������6�6�0�0�0�0�0r!rMc��eZdZdZd�ZdS)rz1Second and subsequent enumerated_list list_items.c���|�||jd��\}}}}||jksC|dkr&||jdks,|js%||jdzks|�|||��s|���|dkrd|_|�|�����\}}	|xj|z
c_|	|_	||_g|gfS)zEnumerated list item.r�ruru)
rrcrrvrrrHr�rr�)
r2rrnr�rr	r�r
r�r�s
          r"r�zEnumeratedList.enumerator�	s���*.�*?�*?��T�[��,�+.�+.�'���$���d�k�!�!��C���X���Z�1H�%H�%H�(,�	�&I�(/�D�4D�q�4H�(I�(I��/�/���6�J�J�)J�
��� � � ��s�?�?��D�I�!%����	�	���!<�!<���,����x����(���"����:�r�!�!r!N)rrrr5r�r r!r"rr�	s)������;�;�"�"�"�"�"r!rc��eZdZdZd�ZdS)r$z(Second and subsequent field_list fields.c�j�|�|��\}}|xj|z
c_||_g|gfS)zField list field.)r&rcr��r2rrnr�r&r�s      r"r�zFieldList.field_marker
s=��"�j�j��/�/���|����u����(����:�r�!�!r!N)rrrr5r�r r!r"r$r$
s)������2�2�"�"�"�"�"r!r$c��eZdZdZd�ZdS)r7z4Second and subsequent option_list option_list_items.c��	|�|��\}}n$#t$r|���YnwxYw|xj|z
c_||_g|gfS)r6)r9rrHrcr�)r2rrnr�r9r�s      r"r�zOptionList.option_marker
s{��	!�-1�-B�-B�5�-I�-I�*��l�l���	!�	!�	!���� � � � � �	!�������'�'���(����:�r�!�!s��<�<N)rrrr5r�r r!r"r7r7
s)������>�>�"�"�"�"�"r!r7c�B�eZdZdZejZejZd�Zej	Z
dS)r<z6Second and subsequent RFC2822-style field_list fields.c�j�|�|��\}}|xj|z
c_||_gdgfS)r;r<)r=rcr�rTs      r"r8zRFC2822List.rfc28220
s?��"�0�0��7�7���|����u����(����=�"�$�$r!N)rrrr5r7rr5r8rErHr�r r!r"r<r<)
s>������@�@��#�H�%�9��%�%�%�
�)�E�E�Er!r<c��eZdZdZd�ZdS)rzz
    Parse field_list fields for extension options.

    No nested parsing is done (including inline markup parsing).
    c���g}t|��dgzD]]}|���r|�|���,|r/d�|��}|t	j||��z
}g}�^dS)z5Override `Body.parse_field_body` for simpler parsing.r�r�N)r�rr}r�rr�)r2r�r�rKr�rmr�s       r"r+z!ExtensionOptions.parse_field_bodyB
s�������N�N�b�T�)�	�	�D��z�z�|�|�
����T�"�"�"�"��
��y�y��'�'������d�3�3�3�����
	�	r!N)rrrr5r+r r!r"rr:
s-��������	�	�	�	�	r!rc�&�eZdZdZejZd�ZdS)rRz,Second and subsequent lines of a line_block.c���|j���}|�||��\}}}|xj|z
c_|jxj|z
c_||_g|gfS)zNew line of line block.)r^r�rSrcr�)r2rrnr�r�rmr�r�s        r"r�zLineBlock.line_blockT
sm���#�3�3�5�5��'+�';�';�E�6�'J�'J�$��h�����t��������h�&���(����:�r�!�!r!N)rrrr5rErHr�r�r r!r"rRrRN
s1������6�6��)�E�"�"�"�"�"r!rRc�,�eZdZdZd�Zd�ZejZdS)r#z0Second and subsequent explicit markup construct.c�j�|�|��\}}|xj|z
c_||_g|gfSr)rrcr�rs      r"r�zExplicit.explicit_markupb
s?��!%�!8�!8��!?�!?���,����x����(����:�r�!�!r!c�j�|�|��\}}|xj|z
c_||_g|gfSr%)r&rcr�rs      r"rRzExplicit.anonymousi
s?��!%�!6�!6�u�!=�!=���,����x����(����:�r�!�!r!N)	rrrr5r�rRrErHr�r r!r"r#r#^
s<������:�:�"�"�"�"�"�"�
�)�E�E�Er!r#c�\�eZdZdZejdejz��dd�ZddgZ	d�Z
d�Zd	S)
r�zG
    Parser for the contents of a substitution_definition element.
    z(%s)::( +|$)r�)�embedded_directiver�rar�c���|�||jdd���\}}|xj|z
c_|j���s||_t
�)Nr�r)�alt)r�rcr^�at_eofr�rgrs      r"raz"SubstitutionDef.embedded_directive
sf��!%����48�K��4H��4K�"0�"M�"M���,����x�����!�(�(�*�*�	-� ,�D���r!c�~�|j���s|j���|_t�r/)r^rdr�r�rgrhs    r"r�zSubstitutionDef.text�
s6���!�(�(�*�*�	H� $� 2� E� E� G� G�D���r!N)rrrr5r�r�rFr�rr5rar�r r!r"r�r�s
s{��������
!+��
�?�-4�-?�,@�!A�!A����H�0��8���������r!r�c��eZdZdZejddd�ZddgZd�Zd�Zd	�Z	d
�Z
d�Zd�Zd
�Z
d�Zejd��Zd�ZdS)ryzs
    Classifier of second line of a text block.

    Could be a paragraph, a definition list item, or a title.
    rmr�)�	underliner�)rgrX)r�rXc���|�||j���dz
��\}}|xj|z
c_|r"|xj|���z
c_gdgfS)zEnd of paragraph.rurX)r�r^r�rcr�)r2rrnr�r�r�s      r"r�z
Text.blank�
sw��"&����t�)�9�9�;�;�a�?�"A�"A��	�;����y� ����	0��K�K�4�-�-�/�/�/�K�K��6�2�~�r!c�8�|r|�d|d��gSr/)r�rrs  r"�eofzText.eof�
s%���	,��J�J�t�W�d�+�+�+��	r!c��tj��}|�|��\}}||z
}|xj|z
c_|jjdz}|�|jj|d�|j���dz|d|d���\}}|�	|��|s#|xj|�
d��z
c_gdgfS)�Definition list item.ruNrMrO)rNrKr[r�r�zDefinition listrX)r�definition_list�definition_list_itemrcr^r�r�rMrhrfr�)	r2rrnr��definitionlist�definitionlistitemr�r�rs	         r"r�zText.indent�
s����.�0�0��+/�+D�+D�W�+M�+M�(��L��,�,�����~�%����#�/�!�3��'+�'=�'=�� �,�V�W�W�5��-�=�=�?�?�!�C�!�1A�'�L�	(>�(J�(J�$���
	
���~�&�&�&��	D��K�K�4�0�0�1B�C�C�C�K�K��6�2�~�r!c���|j���}|d���}|j���}|dz|z}g}t	|��t|��kr�t|��dkrL|jjr,|j�d|���}	|xj	|	z
c_	tjd���|ddz|jjz}
|j�
dtj|
|
��|���}	|�|	��|jjs�|ddz|jjz}
|j���\}}|j�dtj|
|
��||�	��}	|xj	|z
c_	|xj	|	z
c_	g|gfS|d}
g|d
d
�<|�|||
|dz
|��g|gfS)zSection title.rr�r,zfPossible title underline, too short for the title.
Treating it as ordinary text because it's so short.r�r�zTitle underline too short.zUnexpected section title.r|Nru)r^r�r�rrryrEr:rrcrrrmr�rr�r}rarkr�)r2rrnr�r�r�rgr@r�r,r�r,r-r�s              r"rgzText.underline�
s���#�3�3�5�5����
�!�!�#�#���L�'�'�)�)�	����	�)���������Y���/�/��9�~�~��!�!��%�2�'��-�,�,�N�#�-�%�%�C��K�K�3�&�K�K�"�7��?�?�?�#�A�J��-��0B�0G�G�	��m�+�+�0��'�	�9�=�=��,�!�!������$�$�$��!�.�	&���
�T�)�D�,>�,C�C�I��-�A�A�C�C�L�C��
�-�&�&�+��#�I�y�9�9���'�*�*�C�
�K�K�8�#�K�K��K�K�3��K�K��z�2�%�%��!��������
����U�F�E�6�A�:�x�@�@�@��:�r�!�!r!c�>�|j���dz
}d}	|j�d���}nD#tj$r2}|j\}}}	|j�d||	���}Yd}~nd}~wwxYw|t|��z}
|�	|
|��\}}|xj
|z
c_
|xj
|z
c_
|rM	|j���n#t$rYnwxYw|xj
|�
��z
c_
g|gfS)z
Paragraph.ruNTryr{r|)r^r�rOrr}r	r:r�r�r�rcrrgr�)
r2rrnr�r�r,r�rwr,r-r�r�r�s
             r"r�z	Text.text�
s]���&�6�6�8�8�1�<�	���	@��&�5�5��5�F�F�E�E���6�	@�	@�	@�"%�(��E�3���-�%�%�&?�-0�w�&�@�@�C�C�C�C�C�C�����	@�����$�u�+�+�%��!%����y�!A�!A��	�;����y� ������s�����	0�
��"�,�,�.�.�.�.���
�
�
���
�����K�K�4�-�-�/�/�/�K�K��:�r�!�!s'�<�A=�(A8�8A=�C(�(
C5�4C5c��|j���\}}}}|rJ|d���s0|���|r|d����0|s|���Sd�|��}t
j||��}|j�|dz��\|_	|_
|g}|s(|�|�d����|S)zReturn a list of nodes.r�r�ruz
Literal block)
r^r�rr��quoted_literal_blockr�rr�rar@rmr}r�)r2r�r�r�r�r�r�rBs        r"r�zText.literal_block�
s���
�
,�
,�
.�
.�	��6�6�<��	 �x��|�1�1�3�3�	 ��������	 �x��|�1�1�3�3�	 ��	/��,�,�.�.�.��y�y��"�"���+�D�$�7�7�
�#�1�E�E�f�Q�h�O�O�	��	�	�	�!�?���	D��O�O�D�1�1�/�B�B�C�C�C��r!c	��|j���}|jj}tj��}|�|jj|d�||dtfdd����}|�|��|j	S)NF�QuotedLiteralBlockrY)rNrKrEr�)
r^rhr�rr�r�rMrvrf�children)r2rhr��parent_noder�s     r"rtzText.quoted_literal_blocks����,�<�<�>�>���#�/���m�o�o���*�*���*�6�7�7�3�(�{��4F�3H�3G�"I�"I�+�J�J��
	
���~�&�&�&��#�#r!c�@�|j���\}}}}tjd�|t|��z����}|j���dz
}|j�|��\|_|_	|�
||��\}}	||z
}tjdg|	�R�}
||
z
}|ddd�dkr"|
|j�
d|dz���z
}
|�|||
�	��||fS)
Nr�rur�rrMr+z`Blank line missing before literal block (after the "::")? Interpreted as a definition list item.r�r�)r^r�rrnr�r�r�rar@rm�termr�r:rr�)r2�termliner�r�r�r��itemnoder��termlistr�r�s           r"rnzText.definition_list_items;��
�
�
,�
,�
.�
.�	��6�;���-��I�I�h��h���/�0�0�2�2���#�3�3�5�5��9���,�@�@��H�H�	���	��!�Y�Y�x��8�8���(��H����%�b�4�8�4�4�4�
��J����A�;�r�s�s��t�#�#��$�-�,�,�;��a�x�-�!�!�
!�J�	
���(��:��N�N�N���%�%r!z +: +c
��t|��dksJ�|�|d|��\}}tj|d��}|j�|��\|_|_|g}tt|����D]�}||}t|tj
��r�|j�|��}	t|	��dkr|dxx|z
cc<�b|	d�
��}
tj
|
��}|dxx|z
cc<|	dd�D]8}|�tjt!|d��|�����9��|dxx|z
cc<��||fS)z9Return a definition_list's term and optional classifiers.rurr�NT)ryr�rrzr^rar@rmr�r�ry�classifier_delimiterrIr�r}�
classifierr)
r2r�r�rXr��	term_noderdr�rKr�r��textnoder�s
             r"rzz	Text.term-s����5�z�z�Q�����#�/�/��a��&�A�A��
�H��J�u�Q�x�(�(�	��-�A�A�&�I�I�	��	�	���K�	��s�:���'�'�	&�	&�A��a�=�D��$��
�+�+�
&��1�7�7��=�=���u�:�:��?�?��b�M�M�M�T�)�M�M�M�M� ��8�?�?�,�,�D�$�z�$�/�/�H��b�M�M�M�X�-�M�M�M� %�a�b�b�	�J�J��!�(�(�!�,�X�d�D�-A�-A�4�H�H�J�J�J�J�J��"�
�
�
��%�
�
�
�
��(�"�"r!N)rrrr5rXrr5r�rjr�rgr�r�rtrnr�r�rrzr r!r"ryry�
s���������"�]�6�2����H�0�2B�C��������
���")"�)"�)"�V"�"�"�,���"
$�
$�
$�&�&�&�(&�2�:�g�.�.��#�#�#�#�#r!ryc�0�eZdZdZd�Zdd�ZeZeZeZeZ	dS)�SpecializedTextz�
    Superclass for second and subsequent lines of Text-variants.

    All transition methods are disabled. Override individual methods in
    subclasses to re-enable.
    c��gS)zIncomplete construct.r rrs  r"rjzSpecializedText.eofPs���	r!Nc��t�rG�rgrhs    r"rHzSpecializedText.invalid_inputTs���r!rI)
rrrr5rjrHr�r�rgr�r r!r"r�r�GsQ���������������
�E�
�F��I��D�D�Dr!r�c��eZdZdZd�Zd�ZdS)rOz.Second line of potential definition_list_item.c�:�|j�d��gS)zNot a definition.rv)r^r�rrs  r"rjzDefinition.eofbs����(�(��+�+�+��	r!c�j�|�|��\}}|xj|z
c_||_gdgfS)rlrM)rnrcr�)r2rrnr�r|r�s      r"r�zDefinition.indentgs@��!%�!:�!:�7�!C�!C���,����x����(����#�R�'�'r!N)rrrr5rjr�r r!r"rOrO^s8������8�8����
(�(�(�(�(r!rOc�D�eZdZdZdZ	d�Zd�Zd�ZeZd�Z	d
d�Z
d
d�Zd	S)r*zO
    Second line of over- & underlined section title or transition marker.
    ruc��|d���}|jjr
d|j_n(t|��dkr|�|��|jrX|j���\}}tj	|d���}||_
|dz
|_|xj|z
c_d|_gS)z0Transition marker at end of section or document.rFr,r�ru)
rrHr>ry�state_correction�eofcheckr^rar�
transitionr@rmrc)r2rn�markerr,r-r�s      r"rjzLine.eofxs������!�!�#�#���9�-�	+�16�D�I�.�.�
��[�[�1�_�_��!�!�'�*�*�*��=�	&��-�A�A�C�C�L�C���)�G�A�J�?�?�?�J� #�J��%��k�J�O��K�K�:�%�K�K���
��	r!c�4�|j���\}}|d���}t|��dkr|�|��tj|���}||_|dz
|_|xj	|z
c_	gdgfS)zTransition marker.rr,r�rurX)
r^rarryr�rr�r@rmrc)r2rrnr�r,r-r�r�s        r"r�z
Line.blank�s����)�=�=�?�?���W����!�!�#�#���v�;�;��?�?��!�!�'�*�*�*��%��7�7�7�
��
��!�A�+�
�����z�!����6�2�~�r!c��|j���dz
}|d}|j}d}	|j���}n�#t$r�|dz|z}t|�����dkr|�|||d��nG|j�	dtj||��|���}	|xj|	z
c_gd	gfcYSYnwxYw|�d|�d|��}
|���}|���}|j
d
d�|��s�|dz|zdz|z}t|�����dkr|�|||d��n�|j�	dtj|
|
��|���}	|xj|	z
c_gd	gfS||kr�|dz|zdz|z}t|�����dkr|�|||d��nE|j�	dtj|
|
��|���}	|xj|	z
c_gd	gfS|���}g}t|��t|��kr�|dz|zdz|z}t|�����dkr|�|||d��nE|j�d
tj|
|
��|���}	|�|	��|d|df}d|_|�|���|
||dz|��d|_gd	gfS)z#Potential over- & underlined title.rurr�r�r,rvzIncomplete section title.r�rXrgz6Missing matching underline for section title overline.z$Title overline & underline mismatch.zTitle overline too short.)r^r�rrrgryr��short_overliner:rkrr�rcrorrr�r}r�r�r�)
r2rrnr�r��overliner�rgr�r,r@r�r�s
             r"r�z	Line.text�s����#�3�3�5�5��9���1�:������	�	&��*�4�4�6�6�I�I���
	&�
	&�
	&� �4��%�/�I��8�?�?�$�$�%�%��)�)��#�#�G�Y���B�B�B�B��m�*�*�/��'�	�9�=�=��+�!�!�����s�"����6�2�~�%�%�%�C�B�
	&����"*���5�5�5�)�)�<���?�?�$�$���$�$�&�&�	����,�Q�/�5�5�i�@�@�	&� �4��%�/�$�6��B�I��8�?�?�$�$�%�%��)�)��#�#�G�Y���B�B�B�B��m�*�*�L��'���7�7��+�!�!�����s�"����6�2�~�%�
��
"�
"� �4��%�/�$�6��B�I��8�?�?�$�$�%�%��)�)��#�#�G�Y���B�B�B�B��m�*�*�<��)�&�&�9�9�!�+�#�#�����s�"����6�2�~�%��������������X���.�.� �4��%�/�$�6��B�I��8�?�?�$�$�%�%��)�)��#�#�G�Y���B�B�B�B��m�+�+�1��)�&�&�9�9�!�,�#�#������$�$�$��!��i��l�+����
����U�\�\�^�^�V�U�F�Q�J��I�I�I���
��6�2�~�s�A	�	BC#�"C#c�r�|d}|dz|jjz}|j���dz
}t|�����dkr|�|||d��|j�dtj	||��|���}|xj
|z
c_
gdgfS)Nrr�rur,z+Invalid section title or transition marker.r�rX)r^rmr�ryr�r�r:r�rr�rc)r2rrnr�r�r�r�r,s        r"rgzLine.underline�s����1�:���t�O�d�&8�&=�=�	��#�3�3�5�5��9���x��� � �!�!�A�%�%������F�A�>�>�>��m�!�!�;��!�)�Y�7�7��"����	
���s�����6�2�~�r!c��|j�d|���}|xj|z
c_|�||��dS)Nz`Possible incomplete section title.
Treating the overline as ordinary text because it's so short.r�)r:rrcr�)r2rnr�r�r�r,s      r"r�zLine.short_overline�sT���m� � �
3��!����	
���s�������g�u�-�-�-�-�-r!c�n�|j�|��g|dd�<tjdd���)NrXr�)r^r�r�StateCorrection)r2rnr�s   r"r�zLine.state_correction�s9����(�(��/�/�/������
��*�6�6�:�:�:r!N)ru)rrrr5r�rjr�r�r�rgr�r�r r!r"r*r*os����������H�J����$
�
�
�<�<�<�|�F����.�.�.�.�;�;�;�;�;�;r!r*c�\�eZdZdZdejzdd�ZdZdd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
S)rvz�
    Nested parse handler for quoted (unindented) literal blocks.

    Special-purpose.  Not for inclusion in `state_classes`.
    z(%(nonalphanum7bit)s)r�)�initial_quotedr�Fc�Z�t�|||��g|_d|_dSr/)rVr4r��initial_linenor]s   r"r4zQuotedLiteralBlock.__init__�s/�����$�
�u�5�5�5���
�"����r!c��|rt�||gfSr/r�rhs    r"r�zQuotedLiteralBlock.blanks���	+��N��J��*�*r!c��|rk|j�|j��\}}d�|��}t	j||��}||_||_|xj|z
c_nZ|xj|j	�
d|j������z
c_|j���|xj|j
z
c_gS)Nr�z#Literal block expected; none found.r�)r^rar�r�rr�r@rmrcr:r�r�r�r�)r2rnr,r-r�r�s      r"rjzQuotedLiteralBlock.eofs����
	/��-�A�A�8<�8K�M�M�L�C���9�9�W�%�%�D�!�/��d�;�;�M�#&�M� �!(�M���K�K�=�(�K�K�K��K�K�4�=�0�0�5��'�7�7�9�9�1���
�K�K�
��,�,�.�.�.����t�}�$����	r!c���|s
Jd���|j�|j�d|j��������|j���t�)Nz7QuotedLiteralBlock.indent: context should not be empty!r{r��r�r}r:r�r^r�r�rgrhs    r"r�zQuotedLiteralBlock.indents����	&�	&�%�	&�	&�w��
����M��� 9�%)�%7�%G�%G�%I�%I�
 �
K�
K�	L�	L�	L�	
��(�(�*�*�*��r!c�4�|�d��|jd}tjtj|����}|�d||j|jjf��|j	�
��|_|jg|gfS)z7Match arbitrary quote character on the first line only.r�r�quoted)�remove_transitionrr�r�r4�add_transitionr�rlrr^r�r�)r2rrnr��quoter�s      r"r�z!QuotedLiteralBlock.initial_quoted#s������/�0�0�0���Q����*�R�Y�u�-�-�.�.�����H�$�d�k�4�>�3J�K�	M�	M�	M�"�0�@�@�B�B�����~�z�2�-�-r!c�@�|�|j��||gfS)z,Match consistent quotes on subsequent lines.)r}rrhs    r"r�zQuotedLiteralBlock.quoted.s#�����u�|�$�$�$��
�B�&�&r!c���|rd|j�|j�d|j��������|j���t�)Nz#Inconsistent literal block quoting.r�r�rhs    r"r�zQuotedLiteralBlock.text3st���	/��M� � ��
�#�#�$I�)-�);�)K�)K�)M�)M�$�O�O�
P�
P�
P�
��,�,�.�.�.��r!Nr�)rrrr5rXr3rr5r4r�rjr�r�r�r�r r!r"rvrv�s���������#;�T�Y�"F����H�4��#�#�#�#�
+�+�+����$���	.�	.�	.�'�'�'�
����r!rvrT)Cr5�
__docformat__r��typesrrr�rrrr	r
�docutils.statemachinerr�docutils.nodesr
r�rrr�rrrr�docutils.utilsrrrrrrrr%r'r)�	Exceptionr+r-r7rRrVr�rFr�r�r�r�rXr7rEr�rMrr$r7r<rrRr#r�ryr�rOr*rvrZr r!r"�<module>r�sP��
`�`�D#�
�
�	�	�	�*�*�*�*�*�*�*�*�/�/�/�/�/�/�/�/�/�/�0�0�0�0�0�0�0�0�9�9�9�9�9�9�9�9�A�A�A�A�A�A�>�>�>�>�>�>�>�>�����J�J�J�J�J�J�J�J�J�J�J�J�4�4�4�4�4�4�4�4�?�?�?�?�?�?�?�?�?�?�3�3�3�3�3�3�#�"�"�"�"�)�"�"�"�2�2�2�2�2�)�2�2�2�9�9�9�9�9��9�9�9�)�)�)�)�)�"�)�)�)�%�%�%�%�%�Y�%�%�%�*�*�*�*�*�*�*�*�$%�$%�$%�$%�$%�n�$%�$%�$%�N���������4i2�i2�i2�i2�i2�w�i2�i2�i2�X����.W	+�W	+�W	+�W	+�W	+�W	+�W	+�W	+�t"%��S���!������"%��S���!������&�&�&�O*�O*�O*�O*�O*�8�O*�O*�O*�d*+'�+'�+'�+'�+'�$�+'�+'�+'�\)�)�)�)�)�d�)�)�)�X"�"�"�"�"��"�"�"�0�0�0�0�0�_�0�0�0�"�"�"�"�"�_�"�"�"�0	"�	"�	"�	"�	"��	"�	"�	"�"�"�"�"�"��"�"�"�*�*�*�*�*�/�;�*�*�*�"�����y����(
"�
"�
"�
"�
"��
"�
"�
"� *�*�*�*�*��*�*�*�*�����d����4w#�w#�w#�w#�w#�8�w#�w#�w#�t�����d����.(�(�(�(�(��(�(�(�";�;�;�;�;�?�;�;�;�DH�H�H�H�H��H�H�H�V�z�>�>�9��Y�(8�(�D��T�?�K��N�
�E�Dr!

Hacked By AnonymousFox1.0, Coded By AnonymousFox