o f'ha¾ã@súdZdZddlZddlZddlmZmZddlmZm Z m Z ddlm Z m Z ddl mZmZddlmZdd lmZddlZdd lmZmZmZmZdd lmZdd lmZmZmZdd lm Z m!Z!ddlm"Z"ddl#Z#Gdd„de ƒZ$Gdd„de ƒZ%Gdd„de ƒZ&Gdd„de ƒZ'Gdd„de(ƒZ)Gdd„de*ƒZ+Gdd„deƒZ,Gdd„deƒZ-Gdd „d eƒZ.dSd"d#„Z/Gd$d%„d%e*ƒZ0e1d&ƒd'fd(d)„Z2e1d*ƒd'fd+d,„Z3d-d.„Z4Gd/d0„d0e.ƒZ5Gd1d2„d2e5ƒZ6Gd3d4„d4e5ƒZ7Gd5d6„d6e7ƒZ8Gd7d8„d8e7ƒZ9Gd9d:„d:e7ƒZ:Gd;d<„d„d>e7ƒZGdCdD„dDe7ƒZ?GdEdF„dFe7ƒZ@GdGdH„dHe5ƒZAGdIdJ„dJe.ƒZBGdKdL„dLeBƒZCGdMdN„dNeCƒZDGdOdP„dPeCƒZEGdQdR„dRe.ƒZFe5e8e9e:e;ee@eBeDeEeAe6e=fZGdS)Taà 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)Úwhitespace_normalize_name)Ú directivesÚ languagesÚ tableparserÚroles)Úen)Ú escape2nullÚunescapeÚ column_width)Úpunctuation_charsÚ urischemes)Úsplit_escaped_whitespacec@ó eZdZdS)Ú MarkupErrorN©Ú__name__Ú __module__Ú __qualname__©rrú=/usr/lib/python3/dist-packages/docutils/parsers/rst/states.pyr{ó rc@r)ÚUnknownInterpretedRoleErrorNrrrrr r"|r!r"c@r)Ú"InterpretedRoleNotImplementedErrorNrrrrr r#}r!r#c@r)Ú ParserErrorNrrrrr r$~r!r$c@r)ÚMarkupMismatchNrrrrr r%r!r%c@óeZdZdZdd„ZdS)ÚStructz3Stores data attributes for dotted-attribute access.cKs|j |¡dS©N)Ú__dict__Úupdate)ÚselfÚ keywordargsrrr Ú__init__†ózStruct.__init__N)rrrÚ__doc__r-rrrr r'‚ó r'c@seZdZdZ  ddd„ZdS)ÚRSTStateMachinezy reStructuredText's master StateMachine. The entry point to reStructuredText parsing is the `run()` method. rTNc Cs¨t |jj|j¡|_||_|durtƒ}| |j¡t ||j|jgdd|d|_ ||_ |  |j ¡|j j|_||_tj||||dd}|gksLJdƒ‚d|_|_ 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_coder3r4Ú match_titlesÚInlinerÚinit_customizationsr'Úmemor2Úattach_observerÚ note_sourceÚnoder Úrun)r+Ú input_linesr2Ú input_offsetr>r8Úresultsrrr rE’s0 ÿ ú   ÿzRSTStateMachine.run)rTN©rrrr/rErrrr r1Šs ÿr1c@seZdZdZddd„ZdS)ÚNestedStateMachinezh StateMachine run from within other StateMachine runs, to parse nested document structures. TcCsZ||_||_|j|_| |jj¡|j|_|j|_||_t  |||¡}|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!) r>rAr2rBrCr3r4rDr rE)r+rFrGrArDr>rHrrr rE¸szNestedStateMachine.runN©TrIrrrr rJ±srJc@sœeZdZdZeZgZd dd„Zdd„Zdd„Z d d „Z d d „Z  d!dd„Z d idd d fdd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zd S)"ÚRSTStatez` reStructuredText State superclass. Contains methods used by all State subclasses. FcCstddœ|_t |||¡dS)NÚBody©Ú state_classesÚ initial_state)rOÚnested_sm_kwargsr r-©r+Ú state_machineÚdebugrrr r-ÖsÿzRSTState.__init__cCsZt |¡|jj}||_|j|_|j|_|j|_|jj|_t |jdƒs+|jj |j_ dSdS)NÚget_source_and_line) r Ú runtime_initrSrAr3r8r2rDÚparentÚhasattrrU)r+rArrr rVÛs   ÿzRSTState.runtime_initcCs(z |j |¡WdStyYdSw)zT Jump to input line `abs_line_offset`, ignoring jumps past the end. N)rSÚ goto_lineÚEOFError)r+Úabs_line_offsetrrr rYès  ÿzRSTState.goto_linecCs*|j d|jj|||jjf¡|dgfS)zs Override `StateWS.no_match` to generate a system message. This code should never be run. zjInternal error: no transition pattern match. State: "%s"; transitions: %s; context: %s; current line: %r.N)r3ÚsevereÚ __class__rrSÚline)r+ÚcontextÚ transitionsrrr Úno_matchñs ÿþÿ zRSTState.no_matchcCsggfS)zCalled at beginning of file.r©r+r_rrr Úbofþsz RSTState.bofNc Csèd}|dur |j}|d7}|dur|j}|d7}t|ƒ}d} |dkr3z|j ¡} Wn ty2Ynw| s?|dd|ji|¤Ž} | j|||j||d|dkrU|j  | ¡n|   ¡|   ¡} |j rrt|ƒ|dkrr|j  t|ƒ|¡| S)zg Create a new StateMachine rooted at `node` and run it over the input `block`. rNéérT©rArDr>r)Ú nested_smrQÚlenÚnested_sm_cacheÚpopÚ IndexErrorrTrErAÚappendÚunlinkr[rWrSÚ next_line) r+ÚblockrGrDr>Ústate_machine_classÚstate_machine_kwargsÚ use_defaultÚ block_lengthrSÚ new_offsetrrr Ú nested_parses: ÿ ÿ ÿzRSTState.nested_parsec Cs®| dur|j} | dur|j ¡} || d<| dd|ji| ¤Ž} |dur$|}|| j|_| ¡D] \} } t| j|| | ƒq.| j|||j ||d| 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. NrPrTrfr) rgrQÚcopyrTÚstatesÚ blank_finishÚitemsÚsetattrrErArmr[)r+rorGrDrPrxÚblank_finish_stateÚextra_settingsr>rprqrSÚkeyÚvaluerrr Únested_list_parse's&   ÿ  ÿ  zRSTState.nested_list_parsecCs$| |||¡r| |||¡dSdS)z=Check for a valid subsection and create one if it checks out.N)Úcheck_subsectionÚnew_subsection)r+Útitler9ÚstyleÚlinenoÚmessagesrrr ÚsectionEsÿzRSTState.sectionc CsÐ|j}|j}|j}z | |¡d}Wn$ty6t|ƒ|jkr(| |¡YdS|j| ||¡7_YdSw||krS||_t|ƒdkrGd|_ |j   t|ƒd¡t ‚||dkr[dS|j| ||¡7_dS)aÙ Check for a valid subsection header. Return 1 (true) or None (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. rdNreT) rAr5r6ÚindexÚ ValueErrorrhrlrWÚtitle_inconsistentr7rSÚ previous_linerZ)r+r9rƒr„rAr5ÚmylevelÚlevelrrr r€Js,  ú  zRSTState.check_subsectioncCs|jjdt d|¡|d}|S)NzTitle level inconsistent:Ú©r^)r3r\rÚ literal_block)r+Ú sourcetextr„Úerrorrrr r‰ss  þzRSTState.title_inconsistentcCsî|j}|j}|jd7_t ¡}|j|7_| ||¡\}}tj|dg|¢RŽ} t|  ¡ƒ} |d  | ¡|| 7}||7}||7}|j   ||¡|j j d} |j  ¡d} |j|j j| d…| |dd} | | ¡|j|krrt‚||_dS)z?Append new subsection to document tree. On return, check level.rdrÚnamesNT)rGrDr>)rAr6rr†rWÚ inline_textr‚Únormalize_nameÚastextrlr2Únote_implicit_targetrSÚ line_offsetr[rurFrYrZ)r+r‚r„r…rAr‹Ú section_nodeÚ textnodesÚtitle_messagesÚ titlenodeÚnameÚoffsetÚ absoffsetÚ newabsoffsetrrr rys.  þ   zRSTState.new_subsectionc Cs¬d |¡ ¡}t d|¡r/t|ƒdkrgdfS|ddvr&|dd… ¡}n|dd…}d}n|}d }| ||¡\}}tj|d g|¢RŽ}|j  |¡\|_ |_ |g||fS) zW Return a list (paragraph & messages) & a boolean: literal_block next? Ú z(?%(or_group)s)%(suffix)s) Ú isinstanceÚtuplerlÚ build_regexpr£Úlocalsr¥ÚcompileÚUNICODE) Ú definitionr¸rœÚprefixÚsuffixÚpartsÚ part_stringsÚpartÚor_groupÚregexprrr r¶¸s     r¶c @seZdZdZdd„Zdd„Zdd„ZdZd Zd Z d Z d Z d Z dZ dZdeƒZdZdZdd„Z d=dd„Zdd„Zdd„Zdd„Zdd„Zd>d!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd=d/d0„Z d1d2„Z!d3d4„Z"d5d6„Z#d7Z$d8d9„Z%d:d;„Z&eeeeeeee e!d<œ Z'd S)?r?z9 Parse inline markup; call the `parse()` method. cCs g|_dSr()Úimplicit_dispatch)r+rrr r-ÕszInliner.__init__cCs2t|ddƒr d}d}ndtjtjf}dtjtjtjf}tƒ ¡}| t |j ƒ¡d|ddd|j gd ¢fd d|d |j d d ddd|j dd|j gfgfdd|j |j dgfgf}||_ ||_||_tt|ƒt |jd|tj¡t |jd|tj¡t d|tjtjB¡t d|tjtjB¡t |jd|tj¡t |jd|tj¡t |jd|tj¡t |j|dtjtjB¡t d|jd|tjtjB¡t d |tjtjB¡t d!|tjtjB¡d" |_|j |jj|jf¡|jr|j |jj|j f¡|j!r|j |jj"|j#f¡dSdS)#NÚcharacter_level_inline_markupFz (^|(?%s)(?P__?)Ú footnotelabelz\[z(?P\]_)ú[0-9]+z\#(%s)?z\*z(?P%s)Ú backquotez(?P(:%s:)?)z`(?!`)z(\*)z(\*\*)a %(non_unescaped_whitespace_escape_before)s ( ` (?P (?P:%(simplename)s:)? (?P__?)? ) ) %(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 (?P # absolute URI (?P # 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 address z] ) ) %(end_string_suffix)s a %(start_string_prefix)s ( (pep-(?P\d+)(.txt)?) # reference to source file | (PEP\s+(?P\d+)) # reference by name ) %(end_string_suffix)sz{ %(start_string_prefix)s (RFC(-|\s+)?(?P\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·rvr*Úvarsr]Únon_whitespace_afterÚ simplenameÚstart_string_prefixÚend_string_suffixr½r'r¶r¥r¸Únon_whitespace_escape_beforer¹ÚVERBOSEÚnon_whitespace_beforeÚ email_patternÚpatternsrÂrlrÖÚstandalone_uriÚpep_referencesr×Ú pep_referenceÚrfc_referencesrØÚ rfc_reference)r+r<rárâÚargsr½rrr r@Úsü ÿÿþÿ ÿýÿþÿ ýîÿÿÿÿÿÿÿ ö õ  ö õ ÿÿÿÿÿÿþþ ÿææâ á ù ø ý ü° Vÿ ÿ  ÿÿzInliner.init_customizationscCsü|j|_|j|_|j|_||_|jjj}|j}t|ƒ}g}g} g} |ri||ƒ} | rf|   ¡} || dp=| dp=| dp=| d} | || |ƒ\}}}}|   |¡| |7} |re||  d  | ¡|¡7}||7}g} nn|s#d  | ¡|}|rz||  ||¡7}|| 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. rÅrËÚrefendÚfnendr) r3r2r4rWrçrÍr¦ÚdispatchrÚ groupdictrlÚimplicit_inliner£)r+rªr„rArWÚpattern_searchrðÚ remainingÚ processedÚ unprocessedr…ÚmatchÚgroupsÚmethodÚbeforeÚinlinesÚ sysmessagesrrr r­gsJ ÿÿ ÿ ÿ€ðz Inliner.parsez(?]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 (?6s€ÿz%Inliner.phrase_ref..éþÿÿÿ©Úrefurizproblem with embedded link: %r©rœÚ__r#r,Ú anonymousr’)rçrÑr¦rÅrrÚendswithrÖr÷r”rrÓr Úindirect_reference_namerr£Ú adjust_uriÚ referencedrÚ referencer r2Ú note_refnamerlÚnote_indirect_targetÚnote_explicit_targetrW)r+rúÚafterr r rªr÷Ú unescapedÚrawtextÚ aliastextÚ rawaliastextÚunderscore_escapedÚ aliastypeÚaliasrÓÚ alias_partsr#r4Ú node_listrrr r!s‚     ÿÿ ÿ ÿ€ ÿ          zInliner.phrase_refcCs|jj |¡}|r d|S|S)Númailto:)rçrÕr÷)r+rÖr÷rrr r2lszInliner.adjust_uric Csjt ||j||j¡\}}|r||||||ƒ\}}|||fS|jjd||d} | ||| ¡g|| gfS)Nz#Unknown interpreted text role "%s".rŽ)rrr4r3r‘r) r+r rªrr„Úrole_fnr…rÚ messages2r rrr rss ÿ þÿzInliner.interpretedcCs0|j|||jjtjdd\}}}}}||||fS)NT)r)rrçrÒrrrrr rÒ€s þ zInliner.literalc Cs‚| |||jjtj¡\}}}}}|r;t|dtjƒr;t|ƒdks"J‚|d}t| ¡ƒ} |d | ¡|j   ||j ¡||||fS)Nrrdr’) rrçrÓrr´rhr”r•rlr2r7rW) r+r÷r„rúrûrôrürrÓrœrrr Úinline_internal_target†sÿ  zInliner.inline_internal_targetc CsÆ| |||jjtj¡\}}}}}t|ƒdkr]|d}t|tjƒr]| ¡} |j  || ¡|dd…dkr]t  d| |fd¡} |dd…dkrJd| d <n t | ƒ| d <|j  | ¡| |7} | g}||||fS) Nrdrr¢rz|%s%srr*r.r/r#) rrçrÔrÚsubstitution_referencerhr´r•r2Únote_substitution_refr4r”r5) r+r÷r„rúrûrôrürÚ subref_nodeÚ subref_textÚreference_noderrr rF‘s( þ   ÿ    zInliner.substitution_referencec Cs| d¡}t|ƒ}|j}|d| d¡…}|| d¡d…}| d¡r:tjd||d}|t |¡7}|j  |¡nMt  d|¡}|ddkrX|d d…}d |d <|j  |¡n|d krid }d |d <|j  |¡n|t |¡7}|r|||d <|j  |¡t |jj¡r‡| ¡}||g|gfS)ze Handles `nodes.footnote_reference` and `nodes.citation_reference` elements. rÉNrÈÚ citationlabelz[%s]_r"rú#rdÚautoÚ*rr#)rr”rýrÅrþrÚcitation_referenceÚTextr2Únote_citation_refÚfootnote_referenceÚnote_autofootnote_refÚnote_symbol_footnote_refÚnote_footnote_refrÚget_trim_footnote_ref_spacer<r¤) r+r÷r„Úlabelr#rýrúrôÚrefnoderrr rR¦s:   ÿ  ÿ zInliner.footnote_referencec Cs”| d¡}t|ƒ}tj|| d¡|t|ƒd}||d_|r$d|d<n ||d<|j |¡|j}|  d¡}|  d¡} |d|…|g|| d…gfS)Nr#rîr-rrdr/rÈ) rr”rr4r r r2r5rýrÅrþ) r+r÷r„r/Ú referencenamer#Ú referencenoderýrr rrr r4És þ     zInliner.referencecCs|j||ddS)Nrd)r/)r4)r+r÷r„rrr Úanonymous_referenceÚr.zInliner.anonymous_referencecCsh| d¡r| d¡ ¡tjvr2| d¡rd}nd}| d¡}|t|ƒ}tjt|dƒ||d}|gSt‚)NÚschemerÕrBrrÈTr+)rÚlowerrÚschemesrrr4r%)r+r÷r„Ú addschemerªr,r4rrr rèÝs    ÿzInliner.standalone_uricCsz| d¡}| d¡rtt| d¡ƒƒ}n| d¡r#tt| d¡ƒƒ}nt‚|jjj|jjj|}t j t|dƒ||dgS)Nrzpep-Úpepnum1ÚPEPÚpepnum2Tr+) rÚ startswithÚintrr%r2r<Ú pep_base_urlÚpep_file_url_templaterr4)r+r÷r„rªÚpepnumÚrefrrr rêìs    ÿzInliner.pep_referencez rfc%d.htmlcCsX| d¡}| d¡rtt| d¡ƒƒ}|jjj|j|}nt‚t j t|dƒ||dgS)NrÚRFCÚrfcnumTr+) rrcrdrr2r<Ú rfc_base_urlÚrfc_urlr%rr4)r+r÷r„rªrjrhrrr rìús  zInliner.rfc_referencec CsŽ|sgS|jD]5\}}| |¡}|r„Z)d?d@„Z*dAdB„Z+dCdD„Z,d¯dFdG„Z-dHdI„Z.dJdK„Z/dLdM„Z0dNdO„Z1dPdQ„Z2dRdS„Z3dTdU„Z4dVdW„Z5dXdY„Z6dZd[„Z7d\d]„Z8d^d_„Z9d`da„Z:dbdc„Z;ddde„Zdjdk„Z?dldm„Z@dndo„ZAd°dpdq„ZBd±drds„ZCdtdu„ZDeƒZE ee dveFeGƒejHejB¡e dweFeGƒejHejB¡e dxeFeGƒejHejB¡dyeE_"dzd{„ZId|d}„ZJd~d„ZKd€d„ZLd‚dƒ„ZMd„d…„ZNd†d‡„ZOdˆd‰„ZPdŠd‹„ZQdŒd„ZRdŽd„ZSdd‘„ZTd’d“„ZUd”d•„ZVd–d—„ZWd˜d™„ZXdšd›„ZYeIe dœeGjZejHejB¡feJe deGjZejHejB¡feKe džejHejB¡fePe dŸejHejB¡feRe d eGjZejHejB¡fgeE_[d¡d¢„Z\d£d¤„Z]d¥d¦„Z^d§d¨„Z_d©dª„Z`d«d¬„Zad­d®„ZbdES)²rMz: Generic classifier of the first line of a block. ú(ú)rdr¢)r»r¼rÅrþrrÚ.)Ú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<%s>%s%s%s)u[-+*•‣âƒ]( +|$)z((%(parens)s|%(rparen)s|%(period)s)( +|$)z1:(?![: ])([^:\\]|\\.|:(?!([ `]|$)))*(?>>( +|$)z\|( +|$)z \.\.( +|$)z__( +|$)z(%(nonalphanum7bit)s)\1* *$) ÚbulletÚ enumeratorÚ field_markerÚ option_markerÚdoctestÚ line_blockÚgrid_table_topÚsimple_table_topÚexplicit_markupr/r^rªc CsN|j ¡\}}}}| ||¡}|j|7_|s"|j| d¡7_||gfS)z Block quote.z Block quote)rSÚ get_indentedÚ block_quoterWr±) r+r÷r_Ú next_stateÚindentedÚindentr—rxÚelementsrrr r¦Šs ÿ  z Body.indentc Csšg}|rK| ||¡\}}}}}t ¡}| |||¡| |¡|r1| ||¡\} } || 7}|| 7}|}|rI|dsI|dd…}|d7}|rI|dr9|s|S)Nrrd)Úsplit_attributionrr£rurlÚparse_attribution) r+r¥r—r§Úblockquote_linesÚattribution_linesÚattribution_offsetÚnew_line_offsetÚ blockquoteÚ attributionr…rrr r£”s0 ü ÿ   þñzBody.block_quoteu(---?(?!-)|—) *(?=[^ \n])c CsÈd}d}tt|ƒƒD]R}|| ¡}|rZ|rW||dkrW|j |¡}|rW| ||¡\}} |rW|||…} | j| ¡dd| j| dd|d|…| |||d…||fSd}q |}q |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, content offset, attribution lines, attribution offset, remaining indented lines). NFrd)rþ)rÅT)Úrangerhr¤Úattribution_patternr÷Úcheck_attributionÚ trim_leftrþ) r+r¥r—ÚblankÚ nonblank_seenÚir^r÷Úattribution_endr¦Úa_linesrrr r¨®s,   ÿ   þzBody.split_attributioncCsˆd}|d}t|dt|ƒƒD]*}|| ¡}|sn#|dur*t|ƒt| ¡ƒ}qt|ƒt| ¡ƒ|kr9dSq|d7}||pBdfS)zt Check attribution shape. Return the index past the end of the attribution, and the indent. Nrd)NNr)r°rhr¤Úlstrip)r+r¥Úattribution_startr¦r¶r^rrr r²Ñs ÿ zBody.check_attributioncCs\d |¡ ¡}|j ¡|}| ||¡\}}tj|dg|¢RŽ}|j |¡\|_|_ ||fS)Nr r) r£r¤rSr®r“rr¯rUr9r^)r+r¥r—rªr„r™r…rDrrr r©ås zBody.parse_attributionc Cs¶t ¡}|j ¡\|_|_|j|7_|jd|d<| |  ¡¡\}}||7}|jj d}|j |jj |d…|j  ¡d|d|d\}}| |¡|sV|j| d¡7_g|gfS)úBullet list item.rr™rdNÚ BulletList©rGrDrPrxz Bullet list)rÚ bullet_listrSrUr9r^rWrýÚ list_itemrþr—rrFr[rYr±) r+r÷r_r¤Ú bulletlistr¶rxrr­rrr r™ís&ÿ   ü  z Body.bulletcCsd|jj|d…r|j |¡\}}}n |j |¡\}}}}t d |¡¡}|r.|j|||d||fS)Nr ©rGrD)rSr^Úget_known_indentedÚget_first_known_indentedrr¿r£ru)r+r¦r¥r—rxÚlistitemrrr r¿s  ÿ  ÿÿzBody.list_itemc Cs>| |¡\}}}}| |||¡st d¡‚t ¡}|j|7_|dkr)d|d<n||d<|jj|j |d<|jj|j |d<|dkrX||d<|j   d ||f¡} |j| 7_|  | ¡¡\} } || 7}|jjd} |j|jj| d …|j ¡d|d | |||dkd œd \} } | | ¡| sš|j| d¡7_g|gfS)zEnumerated List ItemrªrLrŠÚenumtyper»r¼rdrÅz|}Wnt yLtd|ƒ‚w|dkrTd}n|dkrZd}|sr|jj D] }|jj| |¡rmnq`td ƒ‚|dkryd }nz |jj ||ƒ}Wn t j yd }Ynw||||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. rzenumerator format not matchedrLzunknown enumerator sequence: %sr¶rÚIrŽzenumerator sequence not matchedrdN)rñr“Úformatsr$rÍrÅrþÚsequenceregexpsr÷ÚKeyErrorÚ sequencesÚ convertersr€ÚInvalidRomanNumeralError)r+r÷Úexpected_sequencerñrÏrÈrªrÐrrr rÉ1sP ÿ ÿ€ ÿÿ ÿÿ zBody.parse_enumeratorcCs°|durdSz|j ¡}Wnty|j ¡YdSw|j ¡|dd… ¡s,dS| |d||¡}|rV|\}}z| |¡sF| |¡rIWdSWdStyUYdSwdS)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. Nrd)rSrnrZrŠÚstripÚmake_enumeratorrcÚ TypeError)r+rÐrÏrÈrnÚresultÚnext_enumeratorÚauto_enumeratorrrr rÊhs4  þ  ÿþ þþzBody.is_enumerated_list_itemcCsø|dkrd}nW|dkrt|ƒ}nN| d¡r&|dkrdSt|tdƒdƒ}n| d¡r>zt |¡}Wntjy=YdSwtd |ƒ‚| d ¡rN|  ¡}n| d ¡rX|  ¡}ntd |ƒ‚|j j |}|j ||jd }|j d|jd }||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. rLrŠréNrurdr€z!unknown enumerator sequence: "%s"r]r‚r$)Ústrr0Úchrrxr€ÚtoRomanÚ RomanErrorr$rcr]r‚r“rÍr»r¼)r+rÐrÏrÈršrÍrßràrrr rÜ…s<   ÿÿ    ÿ ÿzBody.make_enumeratorc Cs’t ¡}|j|7_| |¡\}}||7}|jjd}|j|jj|d…|j ¡d|d|d\}}|  |¡|sD|j|  d¡7_g|gfS)zField list item.rdNÚ FieldListr½z Field list) rÚ field_listrWÚfieldrSr—rrFr[rYr±) r+r÷r_r¤rçrèrxrrÒrrr r›ªs   ü  zBody.field_markercCs°| |¡}|j ¡\}}|j ¡}|j | ¡¡\}}}} t ¡} || _|| _ |  ||¡\} } | tj |dg| ¢RŽ7} tj d  |¡g| ¢RŽ} | | 7} |rT| ||| ¡| | fS)Nrr )Úparse_field_markerrSrUr®rÃrþrrèr9r^r“Ú field_nameÚ field_bodyr£Úparse_field_body)r+r÷rœÚsrcÚsrcliner„r¥r¦r—rxÚ field_nodeÚ name_nodesÚ name_messagesrërrr rè»s   ÿz Body.fieldcCs&| ¡dd…}|d| d¡…}|S)z6Extract & return field name from a field marker match.rdNú:)rÚrfind)r+r÷rèrrr réÌszBody.parse_field_markercCs|j|||ddS)NrÁ)ru)r+r¥rrDrrr rìÒszBody.parse_field_bodyc Cs@t ¡}|j ¡\|_|_z | |¡\}}WnKtya}z?|j  d|¡}|j |7_ |j  |  ¡¡\} } } }|  | | ¡} |j | 7_ |sR|j | d¡7_ g|gfWYd}~Sd}~ww|j |7_ ||7}|jjd} |j|jj| d…|j ¡d|d|d\}}| |¡|s›|j | d¡7_ g|gfS)úOption list item.zInvalid option list marker: %sz Option listNrdÚ OptionListr½)rÚ option_listrSrUr9r^Úoption_list_itemrr3r‘rWrÃrþr£r±r—rrFr[rY)r+r÷r_r¤Ú optionlistrÄrxr‘r r¥r¦r—r§rrÒrrr rœÕs>ÿ ÿ €õ    ü  zBody.option_markerc Cs|j ¡}| |¡}|j | ¡¡\}}}}|s"| |¡t d¡‚tj dg|¢RŽ}t  d  |¡¡} t  d|| ¡} |rD|j ||| d| |fS)Nrªrr rÁ)rSr[Úparse_option_markerrÃrþrYrrËrÚ option_groupÚ descriptionr£r÷ru) r+r÷rÚoptionsr¥r¦r—rxrúrûr÷rrr r÷ôs"   ÿ  ÿÿzBody.option_list_itemc CsŒg}| ¡ ¡ d¡}|D]¶}| ¡}d}|d dd¡}t|ƒdkr,||dd…<d}n3t|dƒdkr_|d d¡rB|d d ¡rI|d d ¡r_|ddd…|ddd…g|dd…<d }t|ƒdkr|d d ¡r|d  d¡rd |dd…¡g|dd…<dt|ƒkrdkrºnn+t |¡}|t  |d|d¡7}t|ƒdkr´|tj |d|d|d7}|  |¡q t dt|ƒ|fƒ‚|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, r$rú=rdNreú-z--ú+rú)Ú delimiterz;wrong number of option tokens (=%s), should be 1 or 2: "%s") rr¤r&rhrcr0r£rr˜Ú option_stringÚoption_argumentrlr) r+r÷ÚoptlistÚ optionstringsÚ optionstringÚtokensrÚfirstoptr˜rrr rùsH   ÿ þ ý( ÿ  ÿ  ÿÿzBody.parse_option_markercCs0d |j ¡¡}|jt ||¡7_g|gfS)Nr )r£rSÚget_text_blockrWrÚ doctest_block)r+r÷r_r¤r©rrr r.s z Body.doctestc Csæt ¡}|j|7_|j ¡}| ||¡\}}}||7}|j|7_|sH|jjd} |j|jj| d…|j  ¡d|ddd\} }|  | ¡|sY|j|j j d|dd7_t |ƒrn|djdurid|d_| |¡g|gfS)zFirst line of a line block.rdNÚ LineBlockrr½z%Line block ends without a blank line.rŽ)rržrWrSr®Úline_block_liner—rrFr[rYr3r¯rhr¦Únest_line_block_lines) r+r÷r_r¤ror„r^r…rxrr­rrr rž6s2    ü   þ   zBody.line_blockc Csv|jj| ¡dd\}}}}d |¡}| ||¡\}} tj|dg|¢RŽ} |j ¡dkr6t |  d¡ƒd| _ | | |fS)z(Return one line element of a line_block.T©Ú until_blankr rr³rd) rSrÃrþr£r“rr^rýr¤rhrr¦) r+r÷r„r¥r¦r—rxrªÚ text_nodesr…r^rrr r Ps ÿ ÿ  zBody.line_block_linecCsJtdt|ƒƒD]}t||ddƒdur||dj||_q| |¡dS)Nrdr¦)r°rhrÙr¦Únest_line_block_segment)r+ror‡rrr r\s €zBody.nest_line_block_linescCsœdd„|Dƒ}t|ƒ}g}t ¡}|D]$}|j|kr | |¡qt|ƒr2| |¡| |¡t ¡}| |¡qt|ƒrF| |¡| |¡||dd…<dS)NcSsg|]}|j‘qSr)r¦)r(Úitemrrr Ú csz0Body.nest_line_block_segment..)Úminrržr¦rlrhr)r+roÚindentsÚleastÚ new_itemsÚ new_blockrrrr rbs        zBody.nest_line_block_segmentcCó| ||||jtj¡S)zTop border of a full table.)Ú table_topÚisolate_grid_tablerÚGridTableParser©r+r÷r_r¤rrr rŸuó þzBody.grid_table_topcCr)zTop border of a simple table.)rÚisolate_simple_tablerÚSimpleTableParserrrrr r {rzBody.simple_table_topc CsT| ||¡\}}|j|7_|s%|jjd|j ¡dd}|j|7_g|gfS)zTop border of a generic table.z Blank line required after table.rdrŽ)ÚtablerWr3r¯rSr®) r+r÷r_r¤Úisolate_functionÚ parser_classr!rxr rrr rs þ zBody.table_topc Cs®|ƒ\}}}|rQz#|ƒ}| |¡}|j ¡t|ƒd}| ||¡} | g|} W| |fStjyP} z|j|d | j ¡| j d|} WYd} ~ | |fSd} ~ ww|} | |fS)zParse a table.rdr$)rN) r­rSr®rhÚ build_tablerÚTableMarkupErrorÚmalformed_tabler£rír) r+r#r$ror…rxÚparserÚ tabledataÚ tableliner"r!Úerrrrr r"s,  ÿ  ûÿÿ€ûz Body.tablec CsÂg}d}z |jjdd}Wn'tjy4}z|j\}}}| |jjd||d¡d}WYd}~nd}~ww| ¡|  |j ¡t |d  ¡ƒ}t t |ƒƒD]%}||  ¡||<||ddvrrd}|j t |ƒ|¡||d…=nqM|j |d¡s´d}t t |ƒd ddƒD]}|j ||¡r¦|j t |ƒ|d¡||dd…=nq‡| | |¡¡g||fSt t |ƒƒD]!}t ||ƒ|ksÌ||ddvrÛ| | |¡¡g||fSqº|||fS) NrdT©Ú flush_leftúUnexpected indentation.©r9r^rz+|r¢re)rSr rÚUnexpectedIndentationErrorrírlr3r‘Ú disconnectÚpad_double_widthÚdouble_width_pad_charrhrÛr°rŠÚgrid_table_top_patr÷Úextendr') r+r…rxror+rírîÚwidthr¶rrr rŸsN  ÿ€ü  üý  þ zBody.isolate_grid_tablecCs°|jj}|jj}t|ƒd}t|| ¡ƒ}|jj}d}d}|d}||kr}||} || ƒ} | rut|  ¡ƒ|kr\|j ||¡| |||d…d¡} g| ||kpZ||d ¡ fS|d7}|}|dksr||ksr||d ¡su|} n=|d7}||ks&|r’d} |j ||¡|||d…}nd} |j ||d¡||d…}| |d| ¡} g| | fS|j | |¡||| d…}|  |j ¡|g| |kpÖ|| d ¡ fS)Nrdrz5Bottom/header table border does not match top border.rez$ or no blank line after table bottomrzNo bottom table border found%s.) rSr—rFrhrÛÚsimple_table_border_patr÷rnr'r2r3)r+rÅr¨ÚlimitÚtoplenÚ pattern_matchÚfoundÚfound_atr¶r^r÷r…rþÚextrarorrr r ÅsP ÿ  ñ ÿ   zBody.isolate_simple_tablecCsf| |jd¡d |¡}d}|j ¡t|ƒd}|r!|d|7}|jj|t  ||¡||d}|gS)Nrr zMalformed table.rdrŽ) Úreplacer3r£rSr®rhr3r‘rr)r+roÚdetailrr©rÚ startliner‘rrr r'ðs  ÿzBody.malformed_tablecCsì|\}}}t ¡}|dkr|ddg7<n |r"|ddg7<tjt|ƒd} || 7}|D]} tj| d} |rCd| jd<|d8}| | 7} q0|r_t ¡} | | 7} |D] } | | | |¡7} qTt ¡}| |7} |D] } || | |¡7}qi|S) NrMÚclasseszcolwidths-autozcolwidths-given)Úcols)ÚcolwidthrdÚstub) rr"ÚtgrouprhÚcolspecÚ attributesÚtheadÚbuild_table_rowÚtbody)r+r)r*Ú stub_columnsÚwidthsÚ colwidthsÚheadrowsÚbodyrowsr"rErCrFrHÚrowrJrrr r%ûs0    zBody.build_tablec Cs~t ¡}|D]6}|dur q|\}}}}i} |r|| d<|r!|| d<tjdi| ¤Ž} || 7}d |¡r<|j|||| dq|S)NÚmorerowsÚmorecolsrrÁr)rrPÚentryr£ru) r+Úrowdatar*rPÚcellrQrRrÚ cellblockrGrSrrr rIs$   ÿ€zBody.build_table_rowa? ( _ # anonymous target | # *OR* (?!_) # no underscore at the beginning (?P`?) # optional open quote (?![ `]) # first char. not space or # backquote (?P # reference name .+? ) %(non_whitespace_escape_before)s (?P=quote) # close quote if open quote used ) (?%(simplename)s)_ | # *OR* ` # open backquote (?![ ]) # not space (?P.+?) # hyperlink phrase %(non_whitespace_escape_before)s `_ # close backquote, # reference mark ) $ # end of string aÛ ( (?![ ]) # first char. not space (?P.+?) # substitution text %(non_whitespace_escape_before)s \| # close delimiter ) ([ ]+|$) # followed by whitespace )rÓr4Ú substitutionc Cs |j ¡\}}|j | ¡¡\}}}}| d¡}t|ƒ} t d |¡¡} || _ || _ | ddkrJ| dd…} d| d<| rC| d  | ¡|j   | ¡n&| dkr[d} d| d<|j  | ¡n| t d|¡7} | d  | ¡|j  | ¡| rz|j  | | ¡n|j  | | ¡|r‹|j||| d | g|fS) Nrdr rrLrMr’rNrrÁ)rSrUrÃrþrr”rÚfootnoter£r9r^rlr2Únote_autofootnoteÚnote_symbol_footnoterWÚ note_footnoter7rru) r+r÷rírîr¥r¦rrxrWrœrXrrr rXXs6 ÿ     z Body.footnotec Csª|j ¡\}}|j | ¡¡\}}}}| d¡}t|ƒ} t d |¡¡} || _ || _ | t  d|¡7} | d  | ¡|j  | ¡|j  | | ¡|rP|j||| d| g|fS)Nrdr rr’rÁ)rSrUrÃrþrr”rÚcitationr£r9r^rWrlr2Ú note_citationr7ru) r+r÷rírîr¥r¦rrxrWrœr\rrr r\ws ÿ   z Body.citationc Cs|jjj}|j ¡}|jj| ¡ddd\}}}}|jd| ¡…d |¡}dd„|Dƒ}|d} d} |  | ¡} | r=n| d7} z| || 7} Wn t yTt d ƒ‚wq5|d| …=|dd |  ¡t | ƒdd…  ¡|d<| ||||  d ¡¡} | g|fS) NTF)rÚ strip_indentr cSóg|]}t|ƒ‘qSr©r©r(r^rrr róz)Body.hyperlink_target..rrdzmalformed hyperlink target.r$rœ)ÚexplicitrçrÓrSr®rÃrþrýr£r÷rkrrhrÛÚ make_targetr) r+r÷rmr„ror¦rrxÚ blocktextr Ú blockindexÚ targetmatchrÓrrr Úhyperlink_targetˆs6   ÿ ÿ  ÿù , ÿ zBody.hyperlink_targetcCs€| |||¡\}}|dkr*tj|dt|ƒd}||_| |d||¡|j |¡|S|dkr>t |d¡}| ||||¡|S|S)Nr#rr"r,)Ú parse_targetrrÓr”r1Ú add_targetr2r6)r+roÚ block_textr„Ú target_nameÚ target_typer©rÓrrr rd¡s  zBody.make_targetcCsp|r#|d ¡dd…dkr#d dd„|Dƒ¡}| |¡}|r#d|fStd |¡ƒ}d dd „|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¢Nrr$cSsg|]}| ¡‘qSr)rÛrarrr r»rbz%Body.parse_target..r#css"|] }d t|ƒ ¡¡VqdSr%)r£rr&r'rrr r)Às€ÿz$Body.parse_target..r,)rÛr£Ú is_referencer)r+rorkr„r4r#Ú ref_partsrrr ri°s   ÿzBody.parse_targetcCs4|jjj t|ƒ¡}|sdSt| d¡p| d¡ƒS)NÚsimpleÚphrase)rcrçr4r÷r rr)r+r4r÷rrr rnÄs ÿzBody.is_referencecCs†||_|r1tt|ƒƒ}|d |¡|r'|j |¡}|r!||d<ntd|ƒ‚|j ||j ¡dS|r7||d<d|d<|j  |¡dS)Nr’r,zproblem with URI: %rrdr/) r^r”rrlr8r2rr2r7rWÚnote_anonymous_target)r+Ú targetnamer,rÓr„rœrÖrrr rjËs    zBody.add_targetcCsÈ|jjj}|j ¡\}}|jj| ¡dd\}}}}|jd| ¡…d |¡} |  ¡t |d  ¡ƒ} d} |  | ¡} | r?n| d7} z| dt ||   ¡ƒ} Wn ty\tdƒ‚wq7|d| …=|d  ¡d|  ¡t| ƒdd …|d<|ds„|d=|d7}|r˜|d   ¡s˜| ¡|r˜|d   ¡rŒ|  d ¡} t | ¡}||_||_|s¿|jjd | t | | ¡||d }|g|fS|d  ¡|d<|d  t | ¡¡|j|||d|d\}}d}|dd…D]!}t|tjƒst|tjƒs|j ||7_ ||=qå|d7}qå| !tj"¡D],}| #|¡r8t d| $¡  ¡¡}|jj%d|j&|t | | ¡||d }|g|fSq t|ƒdkrV|jjd| t | | ¡||d }|g|fS|j' (|| |j ¡|g|fS)NF©r^r rTrdr$z"malformed substitution definition.r¢rœz.Substitution definition "%s" missing contents.r/r’ÚSubstitutionDefr½rz6Substitution definition contains illegal element <%s>:z.Substitution definition "%s" empty or invalid.))rcrçrWrSrUrÃrþrýr£r1rr¤r÷rÛrkrrhrjrrÚsubstitution_definitionr9r^r3r¯rrlr rr´ÚInlinerPrWÚtraverseÚElementÚ*disallowed_inside_substitution_definitionsÚpformatr‘Útagnamer2Únote_substitution_def)r+r÷rmrírîror¦rrxrer rfÚ subdefmatchÚsubnameÚsubstitution_noder Únew_abs_offsetr¶rDr{rrr Úsubstitution_defÝsž  ÿ ÿ  ÿù ,ÿ   ý ÿ þ ÿ  ÿ üù ý ÿ zBody.substitution_defcCs<|dst|tjƒr| d¡st|tjƒr| d¡rdSdS)NÚidsr/rMTF)r´rr4ÚgetrR)r+rDrrr rz"s ÿÿ þþz/Body.disallowed_inside_substitution_definitionscKsN| d¡}t ||jj|j¡\}}|j|7_|r"| ||||¡S| |¡S)z?Returns a 2-tuple: list of nodes, and a "blank finish" boolean.rd) rrÚ directiverAr4r2rWÚ run_directiveÚunknown_directive)r+r÷Úoption_presetsÚ type_nameÚdirective_classr…rrr r…*s  ÿÿ zBody.directivec CsÂt|ttfƒrddlm}||ƒ}|j ¡}|jj}|jj|  ¡dd\}} } } d  |jj ||jjd…¡} z|  || ||¡\} }}}Wn,t yq}z |jjd|d  |j¡ft | | ¡|d}|g| fWYd }~Sd }~ww||| ||||| ||jƒ }z| ¡}Wn+tjjjy°}z|jj|j|j|d}|t | | ¡7}|g}WYd }~nd }~wwt|tƒs¼Jd |ƒ‚tt|ƒƒD]}t||tjƒs×Jd ||||fƒ‚qÂ|| 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 rdzError in "%s" directive: %s.r$rŽNz+Directive "%s" must return a list of nodes.z6Directive "%s" returned non-Node object (index %s): %r) r´rrÚdocutils.parsers.rstr‹rSr®r—rÃrþr£rFÚparse_directive_blockrr3r‘rírrrEÚdocutilsÚparsersÚrstÚDirectiveErrorÚsystem_messagerŒr Úlistr°rhÚNodeÚis_next_line_blank)r+r…r÷r‰rˆr‹r„Úinitial_line_offsetr¥r¦r—rxrkÚ argumentsrüÚcontentÚcontent_offsetr?r‘Údirective_instancerÞÚmsg_noder¶rrr r†6sj   ÿ ÿ ÿÿÿ ÿ ý€û  þ ÿ€ü ÿ ÿÿ ÿzBody.run_directivecCsr|j}|j}|r|d ¡s| ¡|d7}|r*|d ¡s*| ¡|r*|d ¡r|r\|js4|js4|r\t|ƒD] \}}| ¡sBnq8|d7}|d|…} ||dd…} ||d} n|} |} g} |rn| ||| ¡\} } ni} | r„|js„|js„| ||d…} |} g} | rœ| d ¡sœ|  ¡| d7} | rœ| d ¡rŒ|js¢|jr©|  || ¡} ng} | r³|s³t dƒ‚| | | | fS)Nrrdr¢zno content permitted) Ú option_specÚ has_contentrÛÚ trim_startÚtrim_endÚrequired_argumentsÚoptional_argumentsÚ enumerateÚparse_directive_optionsÚparse_directive_argumentsr)r+r¥r—r…rˆrržr¶r^Ú arg_blockr™ršrür˜rrr rŽrs^ÿ ÿþÿ  ÿ ÿþ ÿ zBody.parse_directive_blockc Cs†| ¡}t|ƒD]\}}t tjd|¡r#||d…}|d|…}nqg}|r?| ||¡\}} |r;| | ¡||fSt| ƒ‚||fS)Nr›) rvr£r¥r÷rMrçÚparse_extension_optionsr*r) r+rˆrr¦rür¶r^Ú opt_blockÚsuccessr©rrr r¤ s"  ýÿ ÿzBody.parse_directive_optionscCsˆ|j}|j}d |¡}| ¡}t|ƒ|krtd|t|ƒfƒ‚t|ƒ||krB|jr6| d||d¡}|Std||t|ƒfƒ‚|S)Nr z$%s argument(s) required, %s suppliedrdz+maximum %s argument(s) allowed, %s supplied)r¡r¢r£r&rhrÚfinal_argument_whitespace)r+r…r¦ÚrequiredÚoptionalÚarg_textr˜rrr r¥²s$   ÿýÿÿzBody.parse_directive_argumentsc Csút ¡}|j|d|ddd\}}|t|ƒkrdSzt ||¡}WnTty;}zdd|jdfWYd}~Sd}~wtt fyX}zddd   |j¡fWYd}~Sd}~wtj yt}zdd d   |j¡fWYd}~Sd}~ww|r{d |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)rPrx)rzinvalid option blockzunknown option: "%s"Nzinvalid option value: %sr$zinvalid option data: %srd)rzoption data incompletely parsed) rrçrrhrÚextract_extension_optionsrÖrírˆrÝr£ÚExtensionOptionError)r+rÚ datalinesrDrÒrxrür?rrr r§Ãs, þ € € €ÿzBody.parse_extension_optionsc CsT|j ¡}|jjddd\}}}}d |¡}|jjd|t ||¡|d}|g|fS)NrFrtr zUnknown directive type "%s".rŽ)rSr®rÃr£r3r‘rr) r+r‰r„r¥r¦rrxrªr‘rrr r‡äs  ÿ  þ zBody.unknown_directivecCsŠ|j| ¡d… ¡s|j ¡rt ¡gdfS|j | ¡¡\}}}}|r7|d ¡s7| ¡|r7|d ¡r+d  |¡}t ||¡g|fS)Nrdr¢r ) rýrþrÛrSr–rÚcommentrÃr r£)r+r÷r¥r¦rrxrªrrr r²îsÿ ÿÿ z Body.commentaÍ \.\.[ ]+ # 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 cCó0| |¡\}}|j|7_| |¡g|gfS©z3Footnotes, hyperlink targets, directives, comments.)Úexplicit_constructrWÚ explicit_list©r+r÷r_r¤r!rxrrr r¡% ó  zBody.explicit_markupc Cs¤g}|jjD]>\}}| |j¡}|rDz|||ƒWStyC}z|j ¡}d |j¡}|  |j j ||d¡WYd}~nd}~wwq|  |¡\} } | || fS)z>Determine which explicit construct this is, parse & return it.r$rŽN) rcÚ constructsr÷rýrrSr®r£rírlr3r¯r²) r+r÷ÚerrorsrùrmÚexpmatchr‘r„rr!rxrrr rµ, s    €üý zBody.explicit_constructcCsl|jjd}|j|jj|d…|j ¡d|jd||jjd\}}| |¡|s4|j| d¡7_dSdS)z‹ Create a nested state machine for a series of explicit markup constructs (including anonymous hyperlink targets). rdNÚExplicit)rGrDrPrxr>zExplicit markup) rSr—rrFr[rWr>rYr±)r+rxrrÒrrr r¶< s   û ÿzBody.explicit_listcCr³©zAnonymous hyperlink targets.)Úanonymous_targetrWr¶r·rrr r/L r¸zBody.anonymousc Csj|j ¡}|jj| ¡dd\}}}}|jd| ¡…d |¡}dd„|Dƒ}| |||d¡}|g|fS)NTrr cSr_rr`rarrr rY rbz)Body.anonymous_target..r)rSr®rÃrþrýr£rd) r+r÷r„ror¦rrxrerÓrrr r¾S s  ÿ ÿ zBody.anonymous_targetcCs®|jjr |jgdgfS|j ¡dkrt d¡‚t|j ¡ƒdkr7|jjd|j  ¡d}|j |7_ t d¡‚|jj }|jj dt  ||¡|j  ¡d}|j |7_ 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.)rSr>rýrÛrrËrhr3rÎr®rWr^r\rr)r+r÷r_r¤r rerrr r^] s& ý  ý z Body.linecCó|jgdgfS)z%Titles, definition lists, paragraphs.rP©rýrrrr rªs óz Body.textr()rr)rN)crrrr/rÚ TableParserr3r'r“rÍÚkeysrÔr×Ú sequencepatsrdr|rrƒr€rrØrÕrÏr¥r¸r¹r4Úsimple_table_top_patr7ÚpatsrÈÚescaper»r¼rçÚinitial_transitionsr¦r£r±r¨r²r©r™r¿ršrÉrÊrÜr›rèrérìrœr÷rùrržr rrrŸr rr"rr r'r%rIrcrÞr?rärXr\rhrdrirnrjr‚rzr…r†rŽr¤r¥r§r‡r²ràr¹r¡rµr¶r/r¾r^rªrrrr rM.sdý  üü  ÿ   ÿ       þô  ÿ# #7%)  & + í í ô ô ø ÷Þ-E <.!  ò òÿü üÿ üÿ üÿú úÿÝ, rMc@sNeZdZdZej ¡Zded<dd„ejDƒZe dd¡dd „Z d 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;-~]+:( +|$)Úrfc2822cCsg|]}|df‘qS)rMr)r(rœrrr r s ÿzRFC2822Body.r¢)rÍrMc Cs˜tjdgd}|j|7_| |¡\}}||7}|jjd}|j|jj|d…|j ¡d|d|d\}}|  |¡|sG|j|  d¡7_g|gfS)úRFC2822-style field list item.rÍ)rArdNÚ RFC2822Listr½zRFC2822-style field list) rrçrWÚ rfc2822_fieldrSr—rrFr[rYr±) r+r÷r_r¤Ú fieldlistrèrxrrÒrrr rÍ… s"   ü  ÿ zRFC2822Body.rfc2822c Cs~|jd|j d¡…}|jj| ¡dd\}}}}t ¡}|t ||¡7}t d  |¡¡}||7}|r;|j |||d||fS)NròTrr rÁ) rýÚfindrSrÃrþrrèrêrër£ru) r+r÷rœr¥r¦r—rxÚ fieldnodeÚ fieldbodyrrr rЗ s ÿ ÿÿzRFC2822Body.rfc2822_fieldN) rrrr/rMrçrvrËÚinsertrÍrÐrrrr rÌx s ÿ  rÌc@sNeZdZdZddd„ZeZeZeZeZeZ eZ eZ eZ 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`. NcCs|j ¡t‚©z8Not a compound element member. Abort this state machine.)rSrŠrZrrrr Ú invalid_input¾ s zSpecializedBody.invalid_input©NNN)rrrr/rØr¦r™ršr›rœrržrŸr r¡r/r^rªrrrr rÖ¦ s  rÖc@r&)r¼z-Second and subsequent bullet_list list_items.cCsL|jd|jdkr| ¡| | ¡¡\}}|j|7_||_g|gfS)r»rr™)rýrWrØr¿rþrx)r+r÷r_r¤rÄrxrrr r™Ö s  zBulletList.bulletN)rrrr/r™rrrr r¼Ò r0r¼c@r&)ÚDefinitionListz,Second and subsequent definition_list_items.cCrÂ)zDefinition lists.Ú DefinitionrÃrrrr rªå rÄzDefinitionList.textN)rrrr/rªrrrr rÚá r0rÚc@r&)rÆz1Second and subsequent enumerated_list list_items.c Cs¨| ||jd¡\}}}}||jks.|dkr'||jdks.|js.||jdks.| |||¡s2| ¡|dkr9d|_| | ¡¡\}} |j|7_| |_ ||_g|gfS)zEnumerated list item.rÅrLrd) rÉrWrÈrMrÇrÊrØr¿rþrx) r+r÷r_r¤rÈrÏrªrÐrÄrxrrr ršî s$  ÿ ÿ ÿ zEnumeratedList.enumeratorN)rrrr/ršrrrr rÆê r0rÆc@r&)ræz(Second and subsequent field_list fields.cCó,| |¡\}}|j|7_||_g|gfS)zField list field.)rèrWrx©r+r÷r_r¤rèrxrrr r› ó zFieldList.field_markerN)rrrr/r›rrrr ræ r0ræc@r&)rõz4Second and subsequent option_list option_list_items.cCsLz | |¡\}}Wn ty| ¡Ynw|j|7_||_g|gfS)rô)r÷rrØrWrx)r+r÷r_r¤r÷rxrrr rœ s  ÿ zOptionList.option_markerN)rrrr/rœrrrr rõ r0rõc@s*eZdZdZejZejZdd„Zej Z dS)rÏz6Second and subsequent RFC2822-style field_list fields.cCs,| |¡\}}|j|7_||_gdgfS)rÎrÏ)rÐrWrxrÝrrr rÍ$ rÞzRFC2822List.rfc2822N) rrrr/rÌrçrËrÍrÖrØr´rrrr rÏ s  rÏc@r&)r®zz Parse field_list fields for extension options. No nested parsing is done (including inline markup parsing). cCsRg}t|ƒdgD]}| ¡r| |¡q |r&d |¡}|t ||¡7}g}q dS)z5Override `Body.parse_field_body` for simpler parsing.rr N)r”rÛrlr£rr§)r+r¥rrDr¨r^rªrrr rì6 s  €úz!ExtensionOptions.parse_field_bodyN)rrrr/rìrrrr r®. s r®c@seZdZdZejZdd„ZdS)r z,Second and subsequent lines of a line_block.cCsJ|j ¡}| ||¡\}}}|j|7_|jj|7_||_g|gfS)zNew line of line block.)rSr®r rWrx)r+r÷r_r¤r„r^r…rxrrr ržH s  zLineBlock.line_blockN)rrrr/rÖrØr´ržrrrr r B s r c@s&eZdZdZdd„Zdd„ZejZdS)r¼z0Second and subsequent explicit markup construct.cCrÜr´)rµrWrxr·rrr r¡V rÞzExplicit.explicit_markupcCrÜr½)r¾rWrxr·rrr r/] rÞzExplicit.anonymousN) rrrr/r¡r/rÖrØr´rrrr r¼R s  r¼c@sBeZdZdZe dejej¡ddœZ ddgZ dd„Z d d „Z d S) ruzG Parser for the contents of a substitution_definition element. z (%s)::( +|$)r)Úembedded_directiverªrßrªcCs>|j||jddd\}}|j|7_|j ¡s||_t‚)Nr’r)Úalt)r…rWrSÚat_eofrxrZr·rrr rßs s  ÿ z"SubstitutionDef.embedded_directivecCs|j ¡s |j ¡|_t‚r()rSrár–rxrZrrrr rª{ s  zSubstitutionDef.textN) rrrr/r¥r¸r?ràr¹rçrËrßrªrrrr rug sÿÿý ruc@szeZdZdZejdddœZddgZdd„Zd d „Zd d „Z d d„Z dd„Z dd„Z dd„Z dd„Ze d¡Zdd„ZdS)rPzs Classifier of second line of a text block. Could be a paragraph, a definition list item, or a title. r^r)Ú underlinerª)rârM)rªrMcCsH| ||j ¡d¡\}}|j|7_|r|j| ¡7_gdgfS)zEnd of paragraph.rdrM)r§rSr®rWr)r+r÷r_r¤r§r«rrr r´ sÿ z Text.blankcCs|r | d|d¡gSr()r´rbrrr Úeof— szText.eofc Cs”t ¡}| |¡\}}||7}|j|7_|jjd}|j|jj|d…|j ¡d|d|dd\}}|  |¡|sE|j|  d¡7_gdgfS)úDefinition list item.rdNrÚrÛ)rGrDrPrxr{zDefinition listrM) rÚdefinition_listÚdefinition_list_itemrWrSr—rrFr[rYr±) r+r÷r_r¤ÚdefinitionlistÚdefinitionlistitemrxrrÒrrr r¦œ s   ü  z Text.indentcCsT|j ¡}|d ¡}|j ¡}|d|}g}t|ƒt|ƒkrZt|ƒdkr>|jjr9|jjd|d} |j | 7_ t   d¡‚|dd|jj } |jj dt | | ¡|d} | | ¡|jjs|dd|jj } |j ¡\} } |jjdt | | ¡| | d } |j |7_ |j | 7_ g|gfS|d} g|d d …<| ||| |d |¡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/Nrd)rSr®r¤rýrrhr>r3rÎrWrrËr^r¯rrrlrUr\r†)r+r÷r_r¤r„r‚râr9r…r rerírîrƒrrr râ­ sB     ý  ÿ  þ   zText.underlinec Csä|j ¡d}d}z |jjdd}Wn"tjy4}z|j\}}} |jjd|| d}WYd}~nd}~ww|t|ƒ} |  | |¡\} } |j | 7_ |j |7_ | rmz|j  ¡Wn t ycYnw|j |  ¡7_ g|gfS)z Paragraph.rdNTr,r.r/)rSr®r rr0rír3r‘r”r§rWrnrZr) r+r÷r_r¤r@r ror+rírîr¨r§r«rrr rªÕ s. ÿ€þ  ÿ z Text.textcCs’|j ¡\}}}}|r|d ¡s| ¡|r|d ¡r|s#| ¡Sd |¡}t ||¡}|j |d¡\|_ |_ |g}|sG|  |  d¡¡|S)zReturn a list of nodes.r¢r rdz Literal block) rSr¢rÛr Úquoted_literal_blockr£rrrUr9r^rlr±)r+r¥r¦rrxr©rr!rrr rë s  ÿÿ  ÿzText.literal_blockcCsR|j ¡}|jj}t ¡}|j|jj|d…||dtfddœd}| |¡|j S)NFÚQuotedLiteralBlockrN)rGrDr>rq) rSr[r—rryrurFrêrYÚchildren)r+r[rÚ parent_noderrrr réü s ÿý zText.quoted_literal_blockc CsÂ|j ¡\}}}}t d |t|ƒ¡¡}|j ¡d}|j |¡\|_|_ |  ||¡\}} ||7}tj dg| ¢RŽ} || 7}|ddd…dkrU| |j j d|dd7} |j||| d ||fS) Nr rdrrr*rÀz`Blank line missing before literal block (after the "::")? Interpreted as a definition list item.rŽrÁ)rSr¢rrær£r”r®rUr9r^Útermrºr3rÎru) r+Útermliner¥r¦r—rxÚitemnoder„Útermlistr…rºrrr ræ s( ÿÿ ÿýzText.definition_list_itemz +: +c Cst|ƒdksJ‚| |d|¡\}}t |d¡}|j |¡\|_|_|g}tt|ƒƒD]R}||}t |tj ƒrv|j   |¡} t| ƒdkrM|d|7<q,| d  ¡} t  | ¡} |d| 7<| dd…D]} | t t| dƒ| ¡¡qfq,|d|7<q,||fS)z9Return a definition_list's term and optional classifiers.rdrr¢NT)rhr“rrírSrUr9r^r°r´rPÚclassifier_delimiterr&r¤rlÚ classifierr) r+r¨r„rr…Ú term_noderAr¶rDr½rªÚtextnoder¿rrr rí s. ÿ     ÿÿz Text.termN)rrrr/rMrçrËr´rãr¦rârªrrérær¥r¸rñrírrrr rP s ÿ (  rPc@s2eZdZdZdd„Zddd„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. cCsgS)zIncomplete construct.rrbrrr rãA ózSpecializedText.eofNcCst‚rשrZrrrr rØE rözSpecializedText.invalid_inputrÙ) rrrr/rãrØr´r¦rârªrrrr rõ8 s rõc@s eZdZdZdd„Zdd„ZdS)rÛz.Second line of potential definition_list_item.cCs|j d¡gS)zNot a definition.re)rSrŠrbrrr rãS s zDefinition.eofcCs,| |¡\}}|j|7_||_gdgfS)rärÚ)rærWrx)r+r÷r_r¤rïrxrrr r¦X rÞzDefinition.indentN)rrrr/rãr¦rrrr rÛO s rÛc@sNeZdZdZdZ dd„Zdd„Zdd„ZeZd d „Z dd d „Z dd d„Z dS)r¿zO Second line of over- & underlined section title or transition marker. rdcCs€|d ¡}|jjrd|j_n t|ƒdkr| |¡|jr;|j ¡\}}tj |dd}||_ |d|_ |j |7_ d|_gS)z0Transition marker at end of section or document.rFrÁ©r rd) rÛrAr7rhÚstate_correctionÚeofcheckrSrUrÚ transitionr9r^rW)r+r_Úmarkerrírîrûrrr rãi s     zLine.eofcCsd|j ¡\}}|d ¡}t|ƒdkr| |¡tj|d}||_|d|_|j |7_ gdgfS)zTransition marker.rrÁrørdrM) rSrUrÛrhrùrrûr9r^rW)r+r÷r_r¤rírîrürûrrr r´{ s      z Line.blankc Csj|j ¡d}|d}|j}d}z|j ¡}Wn;tyR|d|}t| ¡ƒdkr5| |||d¡n|jj dt   ||¡|d} |j | 7_ gd gfYSYnwd |||f} | ¡}| ¡}|j d d |¡s |d|d|}t| ¡ƒdkr‡| |||d¡nQ|jj d t   | | ¡|d} |j | 7_ gd gfS||krØ|d|d|}t| ¡ƒdkr¿| |||d¡n|jj d t   | | ¡|d} |j | 7_ gd gfS| ¡}g} t|ƒt|ƒkr|d|d|}t| ¡ƒdkr| |||d¡n|jjdt   | | ¡|d} |  | ¡|d|df} d|_| | ¡| | |d| ¡d|_gd gfS)z#Potential over- & underlined title.rdrrr rÁrezIncomplete section title.rŽrMz%s %s %srâz6Missing matching underline for section title overline.z$Title overline & underline mismatch.zTitle overline too short.)rSr®rýrnrZrhr¤Úshort_overliner3r\rrrWr`r÷rr¯rlrúr†r¹) r+r÷r_r¤r„Úoverliner‚rârer r9r…rƒrrr rª‡ sz   ýùý  ý  ý  ý  z Line.textcCsx|d}|d|jj}|j ¡d}t| ¡ƒdkr#| |||d¡|jjdt  ||¡|d}|j |7_ gdgfS)Nrr rdrÁz+Invalid section title or transition marker.rŽrM) rSr^r®rhr¤rýr3r‘rrrW)r+r÷r_r¤rþrer„r rrr râÇ s ý zLine.underlinecCs.|jjd|d}|j|7_| ||¡dS)Nz`Possible incomplete section title. Treating the overline as ordinary text because it's so short.rŽ)r3rÎrWrù)r+r_rer„r¨r rrr rýÔ s ýzLine.short_overlinecCs$|j |¡g|dd…<t dd¡‚)NrMrª)rSrŠrÚStateCorrection)r+r_r¨rrr rùÜ s   zLine.state_correctionN)rd) rrrr/rúrãr´rªr¦rârýrùrrrr r¿` s > r¿c@s^eZdZdZdejddœZdZddd„Zdd „Z d d „Z d d „Z dd„Z dd„Z dd„ZdS)rêzƒ Nested parse handler for quoted (unindented) literal blocks. Special-purpose. Not for inclusion in `state_classes`. z(%(nonalphanum7bit)s)r)Úinitial_quotedrªFcCst |||¡g|_d|_dSr()rLr-r…Úinitial_linenorRrrr r-î s zQuotedLiteralBlock.__init__cCs|rt‚||gfSr(r÷rrrr r´ó s zQuotedLiteralBlock.blankcCs†|r$|j |j¡\}}d |¡}t ||¡}||_||_|j|7_n|j|j j d|j  ¡d7_|j  ¡|j|j 7_gS)Nr z#Literal block expected; none found.rŽ)rSrUrr£rrr9r^rWr3r¯r®rŠr…)r+r_rírîrªrrrr rãù s ÿ    þ zQuotedLiteralBlock.eofcCs8|sJdƒ‚|j |jjd|j ¡d¡|j ¡t‚)Nz7QuotedLiteralBlock.indent: context should not be empty!r.rŽ©r…rlr3r‘rSr®rŠrZrrrr r¦ s ÿÿ zQuotedLiteralBlock.indentcCsZ| d¡|jd}t t |¡tj¡}| d||j|jj f¡|j   ¡|_ |jg|gfS)z7Match arbitrary quote character on the first line only.rrÚquoted) Úremove_transitionrýr¥r¸rÊr¹Úadd_transitionrr]rrSr®r)r+r÷r_r¤Úquotermrrr r s  ÿ z!QuotedLiteralBlock.initial_quotedcCs| |j¡||gfS)z,Match consistent quotes on subsequent lines.)rlrýrrrr r s  zQuotedLiteralBlock.quotedcCs0|r|j |jjd|j ¡d¡|j ¡t‚)Nz#Inconsistent literal block quoting.rŽrrrrr rª$ sÿÿ zQuotedLiteralBlock.textNr²)rrrr/rMrÉrçrËr-r´rãr¦rrrªrrrr rêâ sÿ   rêrK)Hr/Ú __docformat__Úsysr¥Útypesrrrrrrrr Údocutils.statemachiner r Údocutils.nodesr r”r rrrrrÚdocutils.parsers.rst.languagesrÚ_fallback_language_moduleÚdocutils.utilsrrrrrrr€rr"r#r$Ú Exceptionr%Úobjectr'r1rJrLr¶r?rxr|rrƒrMrÌrÖr¼rÚrÆrærõrÏr®r r¼rurPrõrÛr¿rêrOrrrr ÚsŽb    ' nYT.,  8 K  þ