+
    f0ii                       R t ^ RIHt ^ RIt^ RIt^ RIHu Ht ^ RIH	t	H
t
 ^RIHt ^RIHt ]	'       d   ^ RIHt ]P"                  ! R4      tR R	 lt ! R
 R4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R  R!]4      tR# )"a;  
A block processor parses blocks of text and adds new elements to the ElementTree. Blocks of text,
separated from other text by blank lines, may have a different syntax and produce a differently
structured tree than other Markdown. Block processors excel at handling code formatting, equation
layouts, tables, etc.
)annotationsN)TYPE_CHECKINGAny)util)BlockParser)MarkdownMARKDOWNc               $    V ^8  d   QhRRRRRR/# )   mdr   kwargsr   returnr    )formats   "^/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/markdown/blockprocessors.py__annotate__r   *   s!      8 s {     c                `   \        V 4      pVP                  P                  \        V4      R^d4       VP                  P                  \	        V4      R^Z4       VP                  P                  \        V4      R^P4       VP                  P                  \        V4      R^F4       VP                  P                  \        V4      R^<4       VP                  P                  \        V4      R^24       VP                  P                  \        V4      R^(4       VP                  P                  \        V4      R^4       VP                  P                  \        V4      R	^4       VP                  P                  \        V4      R
^4       VP                  P                  \        V4      R^
4       V# )z1Build the default block parser used by Markdown. emptyindentcode
hashheadersetextheaderhrolistulistquote	reference	paragraph)r   blockprocessorsregisterEmptyBlockProcessorListIndentProcessorCodeBlockProcessorHashHeaderProcessorSetextHeaderProcessorHRProcessorOListProcessorUListProcessorBlockQuoteProcessorReferenceProcessorParagraphProcessor)r   r   parsers   &, r   build_block_parserr-   *   sX   _F
##$7$?#N
##$7$?2N
##$6v$>K
##$7$?rR
##$9&$A>SUV
##K$7rB
##N6$:GRH
##N6$:GRH
##$7$?"M
##$6v$>RP
##$6v$>RPMr   c                  j    ] tR t^;tRtR R ltR R ltRR R lltRR	 R
 lltR R lt	R R lt
RtR# )BlockProcessora4  Base class for block processors.

Each subclass will provide the methods below to work with the source and
tree. Each processor will need to define it's own `test` and `run`
methods. The `test` method should return True or False, to indicate
whether the current block should be processed by this processor. If the
test passes, the parser will call the processors `run` method.

Attributes:
    BlockProcessor.parser (BlockParser): The `BlockParser` instance this is attached to.
    BlockProcessor.tab_length (int): The tab length set on the `Markdown` instance.

c                   V ^8  d   QhRR/# r
   r,   r   r   )r   s   "r   r   BlockProcessor.__annotate__J   s     / /{ /r   c                	H    Wn         VP                  P                  V n        R # N)r,   r   
tab_length)selfr,   s   &&r   __init__BlockProcessor.__init__J   s     ))..r   c                    V ^8  d   QhRRRR/# )r
   parentetree.Elementr   zetree.Element | Noner   )r   s   "r   r   r2   N   s       2F r   c                :    \        V4      '       d
   VR,          # R# )z-Return the last child of an `etree` element. N)len)r6   r:   s   &&r   	lastChildBlockProcessor.lastChildN   s    v;;":r   Nc               $    V ^8  d   QhRRRRRR/# )r
   textstrlengthz
int | Noner   ztuple[str, str]r   )r   s   "r   r   r2   U   s&     C C# Cz C_ Cr   c                n   Vf   V P                   p. pVP                  R4      pV F_  pVP                  RV,          4      '       d   VP                  WRR 4       K6  VP	                  4       '       g   VP                  R4       K_   M	  RP                  V4      RP                  V\        V4      R 4      3# )z<Remove a tab from the front of each line of the given text. N
  )r5   split
startswithappendstripjoinr>   )r6   rB   rD   newtextlineslines   &&&   r   detabBlockProcessor.detabU   s    >__F

4 DsV|,,tG}-ZZ\\r"  yy!499U3w<=-A#BBBr   c               $    V ^8  d   QhRRRRRR/# )r
   rB   rC   levelintr   r   )r   s   "r   r   r2   d   s!        s  3  s  r   c                &   VP                  R4      p\        \        V4      4       FX  pW4,          P                  RV P                  ,          V,          4      '       g   K:  W4,          V P                  V,          R W4&   KZ  	  RP                  V4      # )z>Remove a tab from front of lines but allowing dedented lines. rF   rG   N)rI   ranger>   rJ   r5   rM   )r6   rB   rT   rO   is   &&&  r   
looseDetabBlockProcessor.looseDetabd   so    

4 s5z"Ax""3t#6u#<== 8DOOE$9$:; # yyr   c               $    V ^8  d   QhRRRRRR/# r
   r:   r;   blockrC   r   boolr   )r   s   "r   r   r2   l   s!      =   r   c                    R# )a  Test for block type. Must be overridden by subclasses.

As the parser loops through processors, it will call the `test`
method on each to determine if the given block of text is of that
type. This method must return a boolean `True` or `False`. The
actual method of testing is left to the needs of that particular
block type. It could be as simple as `block.startswith(some_string)`
or a complex regular expression. As the block type may be different
depending on the parent of the block (i.e. inside a list), the parent
`etree` element is also provided and may be used as part of the test.

Keyword arguments:
    parent: An `etree` element which will be the parent of the block.
    block: A block of text from the source which has been split at blank lines.
Nr   r6   r:   r]   s   &&&r   testBlockProcessor.testl   s      	r   c               $    V ^8  d   QhRRRRRR/# )r
   r:   r;   blocks	list[str]r   zbool | Noner   )r   s   "r   r   r2   ~   s!      -  { r   c                    R# )a  Run processor. Must be overridden by subclasses.

When the parser determines the appropriate type of a block, the parser
will call the corresponding processor's `run` method. This method
should parse the individual lines of the block and append them to
the `etree`.

Note that both the `parent` and `etree` keywords are pointers
to instances of the objects which should be edited in place. Each
processor must make changes to the existing objects as there is no
mechanism to return new/different objects to replace them.

This means that this method should be adding `SubElements` or adding text
to the parent, and should remove (`pop`) or add (`insert`) items to
the list of blocks.

If `False` is returned, this will have the same effect as returning `False`
from the `test` method.

Keyword arguments:
    parent: An `etree` element which is the parent of the current block.
    blocks: A list of all remaining blocks of the document.
Nr   )r6   r:   rd   s   &&&r   runBlockProcessor.run~   s    0 	r   )r,   r5   r4   )   )__name__
__module____qualname____firstlineno____doc__r7   r?   rQ   rY   ra   rg   __static_attributes__r   r   r   r/   r/   ;   s+    /C $ r   r/   c                  n   a  ] tR t^tRtR.t RR.t V 3R ltR R ltR R	 lt	R
 R lt
R R ltRtV ;t# )r"   zmProcess children of list items.

Example

    * a list item
        process this part

        or this part

liulolc                	|   < \         SV `  ! V!   \        P                  ! R V P                  ,          4      V n        R# )z^(([ ]{%s})+)N)superr7   recompiler5   	INDENT_RE)r6   args	__class__s   &*r   r7   ListIndentProcessor.__init__   s*    $$4t$FGr   c               $    V ^8  d   QhRRRRRR/# r\   r   )r   s   "r   r    ListIndentProcessor.__annotate__   s!     : := : : :r   c                	   VP                  R V P                  ,          4      ;'       d    V P                  P                  P	                  R4      '       * ;'       dh    VP
                  V P                  9   ;'       gG    \        V4      ;'       d4    VR,          RJ;'       d!    VR,          P
                  V P                  9   # )rG   detabbedNr=   )	rJ   r5   r,   stateisstatetag
ITEM_TYPESr>   
LIST_TYPESr`   s   &&&r   ra   ListIndentProcessor.test   s    DOO 34 : :!!))*55: :ZZ4??* 9 9V 8 84!7 8 8BZ^^t6		:r   c               $    V ^8  d   QhRRRRRR/# r
   r:   r;   rd   re   r   Noner   )r   s   "r   r   r}      s!     "" ""- "" ""t ""r   c                	B   VP                  ^ 4      pV P                  W4      w  rEV P                  W44      pV P                  P                  P                  R4       VP                  V P                  9   dx   \        V4      '       dI   VR,          P                  V P                  9   d'   V P                  P                  VR,          V.4       EM,V P                  P                  W.4       EMVP                  V P                  9   d   V P                  P                  WS.4       M\        V4      '       d   VR,          P                  V P                  9   d   VR,          P                  '       dV   \        P                  ! R4      pVR,          P                  Vn        RVR,          n        VR,          P                  ^ V4       V P                  P                  VR,          V4       MV P!                  WS4       V P                  P                  P#                  4        R# )    r   prH   Nr=   )pop	get_levelrY   r,   r   setr   r   r>   r   parseBlocksrB   etreeElementinsert
parseChunkcreate_itemreset)r6   r:   rd   r]   rT   siblingr   s   &&&    r   rg   ListIndentProcessor.run   sr   

16-j)::( 6{{vbz~~@''r
UG< ''8[[DOO+KK##GW5\\gbkoo@ r{ MM#& ))#% ""1a(KK""72;6W,!r   c               $    V ^8  d   QhRRRRRR/# )r
   r:   r;   r]   rC   r   r   r   )r   s   "r   r   r}      s!     - -- - - -r   c                l    \         P                  ! VR4      pV P                  P                  W2.4       R# )z=Create a new `li` and parse the block with it as the parent. rq   N)r   
SubElementr,   r   )r6   r:   r]   rq   s   &&& r   r   ListIndentProcessor.create_item   s(    fd+G,r   c               $    V ^8  d   QhRRRRRR/# )r
   r:   r;   r]   rC   r   ztuple[int, etree.Element]r   )r   s   "r   r   r}      s"       c >W r   c                   V P                   P                  V4      pV'       d-   \        VP                  ^4      4      V P                  ,          pM^ pV P
                  P                  P                  R4      '       d   ^pM^ pWE8  dx   V P                  V4      pVe_   VP                  V P                  9   g   VP                  V P                  9   d)   VP                  V P                  9   d
   V^,          pTpKy   WQ3# WQ3# )z.Get level of indentation based on list level. list)rx   matchr>   groupr5   r,   r   r   r?   r   r   r   )r6   r:   r]   mindent_levelrT   childs   &&&    r   r   ListIndentProcessor.get_level   s     NN  'qwwqz?4??:LL;;$$V,,E E"NN6*E!		T__,		T__0L99/QJE }u}r   )rx   )rj   rk   rl   rm   rn   r   r   r7   ra   rg   r   r   ro   __classcell__rz   s   @r   r"   r"      s@    	 J-J9H:""H-
 r   r"   c                  2    ] tR t^tRtR R ltR R ltRtR# )r#   zProcess code blocks. c               $    V ^8  d   QhRRRRRR/# r\   r   )r   s   "r   r   CodeBlockProcessor.__annotate__   s!     5 5= 5 5 5r   c                	F    VP                  R V P                  ,          4      # )rG   )rJ   r5   r`   s   &&&r   ra   CodeBlockProcessor.test   s    DOO 344r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r     s!     & &- & &t &r   c           	     	   V P                  V4      pVP                  ^ 4      pRpVe   VP                  R8X  d   \        V4      '       d   V^ ,          P                  R8X  du   V^ ,          pV P	                  V4      w  rE\
        P                  ! RP                  VP                  \
        P                  ! VP                  4       4      4      4      Vn        M\        P                  ! VR4      p\        P                  ! VR4      pV P	                  V4      w  rE\
        P                  ! R\
        P                  ! VP                  4       4      ,          4      Vn        V'       d   VP                  ^ V4       R# R# )r   rH   Nprer   z{}
{}
z%s
)r?   r   r   r>   rQ   r   AtomicStringr   rB   code_escaperstripr   r   r   )r6   r:   rd   r   r]   theRestr   r   s   &&&     r   rg   CodeBlockProcessor.run  s   ..(

1GKK5$8w<<GAJNNf4 1:D!ZZ.NE))!!$))T-=-=elln-MNDI
 ""651C##C0D!ZZ.NE))&43C3CELLN3S*STDI MM!W%	 r   r   Nrj   rk   rl   rm   rn   ra   rg   ro   r   r   r   r#   r#      s     5& &r   r#   c                  b    ] tR tRtRt]P                  ! R4      tR R ltR R lt	R R	 lt
R
tR# )r)   i  zProcess blockquotes. z(^|\n)[ ]{0,3}>[ ]?(.*)c               $    V ^8  d   QhRRRRRR/# r\   r   )r   s   "r   r    BlockQuoteProcessor.__annotate__!  s&     R R= R R Rr   c                	    \        V P                  P                  V4      4      ;'       d    \        P                  ! 4       '       * # r4   )r^   REsearchr   nearing_recursion_limitr`   s   &&&r   ra   BlockQuoteProcessor.test!  s.    DGGNN5)*QQ43O3O3Q/QQr   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r   $  s!     " "- " "t "r   c                	   VP                  ^ 4      pV P                  P                  V4      pV'       d~   VRVP                  4        pV P                  P                  W.4       RP                  W4P                  4       R P                  R4       Uu. uF  q`P                  V4      NK  	  up4      pV P                  V4      pVe   VP                  R8X  d   TpM\        P                  ! VR4      pV P                  P                  P                  R4       V P                  P                  W4       V P                  P                  P!                  4        R# u upi )r   NrF   
blockquote)r   r   r   startr,   r   rM   rI   cleanr?   r   r   r   r   r   r   r   )	r6   r:   rd   r]   r   beforerP   r   r   s	   &&&      r   rg   BlockQuoteProcessor.run$  s   

1GGNN5!:AGGI&FKK##FH5II.3GGIJ.?.E.Ed.KL.KdD!.KLE ..(7;;,#>E $$V\:E 	l+u,! Ms   Ec                    V ^8  d   QhRRRR/# )r
   rP   rC   r   r   )r   s   "r   r   r   <  s      # # r   c                    V P                   P                  V4      pVP                  4       R8X  d   R# V'       d   VP                  ^4      # V# )z%Remove `>` from beginning of a line. >rH   )r   r   rL   r   )r6   rP   r   s   && r   r   BlockQuoteProcessor.clean<  s;    GGMM$::<3771:Kr   r   N)rj   rk   rl   rm   rn   rv   rw   r   ra   rg   r   ro   r   r   r   r)   r)     s)     	.	/BR"0 r   r)   c                     a  ] tR tRt$ RtRtR]R&    RtR]R&    RtR	]R
&    RR.t	R]R&    R V 3R llt
R R ltR R ltR R ltRtV ;t# )r'   iG  zProcess ordered list blocks. rs   rC   TAG1
STARTSWITHTr^   LAZY_OLrr   re   SIBLING_TAGSc                   V ^8  d   QhRR/# r1   r   )r   s   "r   r   OListProcessor.__annotate__Y  s     	P 	P{ 	Pr   c                	~  < \         SV `  V4       \        P                  ! R V P                  ^,
          ,          4      V n        \        P                  ! RV P                  ^,
          ,          4      V n        \        P                  ! RV P                  V P                  ^,          ^,
          3,          4      V n        R# )z^[ ]{0,%d}\d+\.[ ]+(.*)z!^[ ]{0,%d}((\d+\.)|[*+-])[ ]+(.*)z ^[ ]{%d,%d}((\d+\.)|[*+-])[ ]+.*N)ru   r7   rv   rw   r5   r   CHILD_RErx   r6   r,   rz   s   &&r   r7   OListProcessor.__init__Y  s     **74??Q;NOP

#G$(OOa$7$9 : $G%)__doo6IA6M$N%O Pr   c               $    V ^8  d   QhRRRRRR/# r\   r   )r   s   "r   r   r   d  !     * *= * * *r   c                	J    \        V P                  P                  V4      4      # r4   r^   r   r   r`   s   &&&r   ra   OListProcessor.testd      DGGMM%())r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r   g  s!     9" 9"- 9" 9"t 9"r   c                	   V P                  VP                  ^ 4      4      pV P                  V4      pVEe   VP                  V P                  9   Edq   TpVR
,          P
                  '       dV   \        P                  ! R4      pVR
,          P
                  Vn        RVR
,          n        VR
,          P                  ^ V4       V P                  VR
,          4      pVeW   VP                  '       dE   \        P                  ! VR
,          R4      pVP                  P                  4       Vn        RVn	        \        P                  ! VR4      pV P                  P                  P                  R4       VP                  ^ 4      p	V P                  P                  W.4       V P                  P                  P!                  4        MpVP                  R9   d   TpM\\        P                  ! WP"                  4      pV P$                  '       g+   V P&                  R8w  d   V P&                  VP(                  R&   V P                  P                  P                  R4       V F  p
V
P+                  R	V P,                  ,          4      '       d'   V P                  P                  VR
,          V
.4       KQ  \        P                  ! VR4      pV P                  P                  W.4       K  	  V P                  P                  P!                  4        R# )r   Nr   rH   rq   	looselistr   r   r   rG   r=   )rs   rr   )	get_itemsr   r?   r   r   rB   r   r   r   tailr   lstripr,   r   r   r   r   r   r   r   attribrJ   r5   )r6   r:   rd   itemsr   lstr   lchrq   	firstitemitems   &&&        r   rg   OListProcessor.rung  s%   vzz!}-..(7;;$2C2C#CC 2w||| MM#&R!BBq!$ ..R)C3888$$SWc2* !!#t,BKK!!+.		!IKK##B4KK##%ZZ<' C ""6884C<<<DOOs$:&*oo

7#f% Ds4??233''B$8 %%c40''F3  	!r   c                    V ^8  d   QhRRRR/# )r
   r]   rC   r   re   r   )r   s   "r   r   r     s      s y r   c                   . pVP                  R4       EFJ  pV P                  P                  V4      pV'       d   V'       g[   V P                  R8X  dJ   \        P
                  ! R4      pVP                  VP                  ^4      4      P                  4       V n        VP                  VP                  ^4      4       K  V P                  P                  V4      '       dc   VR,          P                  RV P                  ,          4      '       d    RP                  VR,          V4      VR&   EK  VP                  V4       EK.  RP                  VR,          V4      VR&   EKM  	  V# )zBreak a block into list items. rF   rs   z(\d+)rG   {}
{}r=   )rI   r   r   r   rv   rw   r   r   rK   rx   rJ   r5   r   )r6   r]   r   rP   r   
INTEGER_REs   &&    r   r   OListProcessor.get_items  s    KK%D##D)A T!1!#H!5J&0&6&6qwwqz&B&H&H&JDOQWWQZ(%%d++9''DOO(;<< (b	4 @E"ILL& %OOE"It<b	) &* r   )r   rx   r   r   )rj   rk   rl   rm   rn   r   __annotations__r   r   r   r7   ra   rg   r   ro   r   r   s   @r   r'   r'   G  sd    (CO6J GT*#TlL)*
	P 	P*9"v r   r'   c                  D   a  ] tR tRt$ RtRtR]R&    R V 3R lltRtV ;t	# )	r(   i  zProcess unordered list blocks. rr   rC   r   c                   V ^8  d   QhRR/# r1   r   )r   s   "r   r   UListProcessor.__annotate__  s     Q Q{ Qr   c                	   < \         SV `  V4       \        P                  ! R V P                  ^,
          ,          4      V n        R# )z^[ ]{0,%d}[*+-][ ]+(.*)N)ru   r7   rv   rw   r5   r   r   s   &&r   r7   UListProcessor.__init__  s/     **74??Q;NOPr   )r   )
rj   rk   rl   rm   rn   r   r   r7   ro   r   r   s   @r   r(   r(     s    *CO6Q Qr   r(   c                  V    ] tR tRtRt]P                  ! R4      tR R ltR R lt	Rt
R	# )
r$   i  zProcess Hash Headers. z>(?:^|\n)(?P<level>#{1,6})(?P<header>(?:\\.|[^\\])*?)#*(?:\n|$)c               $    V ^8  d   QhRRRRRR/# r\   r   )r   s   "r   r    HashHeaderProcessor.__annotate__  s!     + += + + +r   c                	J    \        V P                  P                  V4      4      # r4   )r^   r   r   r`   s   &&&r   ra   HashHeaderProcessor.test  s    DGGNN5)**r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r     s&     B B- B Bt Br   c           	     	   VP                  ^ 4      pV P                  P                  V4      pV'       d   VRVP                  4        pW4P	                  4       R pV'       d   V P
                  P                  W.4       \        P                  ! VR\        VP                  R4      4      ,          4      pVP                  R4      P                  4       Vn        V'       dQ   V P
                  P                  P                  R4      '       d   V P                  V4      pVP!                  ^ V4       R# R# \"        P%                  RV,          4       R# )r   Nh%drT   headerr   zWe've got a problem header: %r)r   r   r   r   endr,   r   r   r   r>   r   rL   rB   r   r   rY   r   loggerwarn)r6   r:   rd   r]   r   r   afterhs   &&&     r   rg   HashHeaderProcessor.run  s    

1GGNN5!:AGGI&F%%'(OE ''9  QWWW5E1F)FGAWWX&,,.AF;;$$,,[99 !OOE2Ea'  KK85@Ar   r   N)rj   rk   rl   rm   rn   rv   rw   r   ra   rg   ro   r   r   r   r$   r$     s'    ! 
U	VB+B Br   r$   c                  l    ] tR tRtRt]P                  ! R]P                  4      tR R lt	R R lt
RtR	# )
r%   i  zProcess Setext-style Headers. z^.*?\n[=-]+[ ]*(\n|$)c               $    V ^8  d   QhRRRRRR/# r\   r   )r   s   "r   r   "SetextHeaderProcessor.__annotate__  r   r   c                	J    \        V P                  P                  V4      4      # r4   r   r`   s   &&&r   ra   SetextHeaderProcessor.test  r   r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r    s!     3 3- 3 3t 3r   c                	t   VP                  ^ 4      P                  R4      pV^,          P                  R4      '       d   ^pM^p\        P                  ! VRV,          4      pV^ ,          P                  4       Vn        \        V4      ^8  d+   VP                  ^ RP                  VR,          4      4       R# R# )r   rF   =r   :r
   NNN)
r   rI   rJ   r   r   rL   rB   r>   r   rM   )r6   r:   rd   rO   rT   r   s   &&&   r   rg   SetextHeaderProcessor.run  s    

1##D)8s##EEVUU]3q!u:>MM!TYYuRy12 r   r   Nrj   rk   rl   rm   rn   rv   rw   	MULTILINEr   ra   rg   ro   r   r   r   r%   r%     s+    ) 
,bll	;B*3 3r   r%   c                  p    ] tR tRtRtRt]P                  ! ]]P                  4      t	R R lt
R R ltRtR	# )
r&   i  zProcess Horizontal Rules. zf^[ ]{0,3}(?=(?P<atomicgroup>(-+[ ]{0,2}){3,}|(_+[ ]{0,2}){3,}|(\*+[ ]{0,2}){3,}))(?P=atomicgroup)[ ]*$c               $    V ^8  d   QhRRRRRR/# r\   r   )r   s   "r   r   HRProcessor.__annotate__  s!      =   r   c                	\    V P                   P                  V4      pV'       d	   W0n        R # R# )TF)	SEARCH_REr   r   )r6   r:   r]   r   s   &&& r   ra   HRProcessor.test  s$    NN!!%(Jr   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r    s!     ( (- ( (t (r   c                	t   VP                  ^ 4      pV P                  pVRVP                  4        P                  R4      pV'       d   V P                  P                  W.4       \        P                  ! VR4       W4P                  4       R P                  R4      pV'       d   VP                  ^ V4       R# R# )r   NrF   r   )r   r   r   r   r,   r   r   r   r   r   r   )r6   r:   rd   r]   r   prelines	postliness   &&&    r   rg   HRProcessor.run  s    

1

%++-(//5KK##FJ7&))+,'..t4	MM!Y' r   )r   N)rj   rk   rl   rm   rn   r   rv   rw   r  r  ra   rg   ro   r   r   r   r&   r&     s0    % 
sB

2r||,I( (r   r&   c                  2    ] tR tRtRtR R ltR R ltRtR# )	r!   i&  z;Process blocks that are empty or start with an empty line. c               $    V ^8  d   QhRRRRRR/# r\   r   )r   s   "r   r    EmptyBlockProcessor.__annotate__)  s!     3 3= 3 3 3r   c                	B    V'       * ;'       g    VP                  R 4      # )rF   )rJ   r`   s   &&&r   ra   EmptyBlockProcessor.test)  s    y22E,,T22r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r  ,  s!      -  t r   c                	   VP                  ^ 4      pRpV'       d&   RpVR,          pV'       d   VP                  ^ V4       V P                  V4      pVe   VP                  R8X  ds   \	        V4      '       d`   V^ ,          P                  R8X  dF   \
        P                  ! RP                  V^ ,          P                  V4      4      V^ ,          n        R# R# R# R# R# )r   z

rF   :ri   NNNr   r   z{}{})	r   r   r?   r   r>   r   r   r   rB   )r6   r:   rd   r]   fillerr   r   s   &&&    r   rg   EmptyBlockProcessor.run,  s    

1 FBiGa)..(GKK5$8w<<GAJNNf4"//gajoov6GAJO 5< %9r   r   Nr   r   r   r   r!   r!   &  s    F3 r   r!   c                  l    ] tR tRtRt]P                  ! R]P                  4      tR R lt	R R lt
RtR	# )
r*   iA  zProcess link references. z\^[ ]{0,3}\[([^\[\]]*)\]:[ ]*\n?[ ]*([^\s]+)[ ]*(?:\n[ ]*)?((["\'])(.*)\4[ ]*|\((.*)\)[ ]*)?$c               $    V ^8  d   QhRRRRRR/# r\   r   )r   s   "r   r   ReferenceProcessor.__annotate__G  !      =   r   c                	    R # Tr   r`   s   &&&r   ra   ReferenceProcessor.testG      r   c               $    V ^8  d   QhRRRRRR/# )r
   r:   r;   rd   re   r   r^   r   )r   s   "r   r   r"  J  s!      -  t r   c                	L   VP                  ^ 4      pV P                  P                  V4      pV'       Ed]   VP                  ^4      P	                  4       P                  4       pVP                  ^4      P                  R4      P                  R4      pVP                  ^4      ;'       g    VP                  ^4      pWg3V P                  P                  P                  V&   W4P                  4       R P	                  4       '       d2   VP                  ^ W4P                  4       R P                  R4      4       VRVP                  4        P	                  4       '       d3   VP                  ^ VRVP                  4        P                  R4      4       R# VP                  ^ V4       R# )r   <r   NrF   TF)r   r   r   r   rL   lowerr   r   r,   r   
referencesr   r   r   )r6   r:   rd   r]   r   idlinktitles   &&&     r   rg   ReferenceProcessor.runJ  s1   

1GGNN5!1!!#))+B771:$$S)005DGGAJ,,!''!*E-1MDKKNN%%b)UUWX$$&&auuwx!7!7!=>Zaggi &&((az	!2!9!9$!?@ar   r   Nr
  r   r   r   r*   r*   A  s.    $	gikiuiu
B r   r*   c                  2    ] tR tRtRtR R ltR R ltRtR# )	r+   i^  zProcess Paragraph blocks. c               $    V ^8  d   QhRRRRRR/# r\   r   )r   s   "r   r   ParagraphProcessor.__annotate__a  r#  r   c                	    R # r%  r   r`   s   &&&r   ra   ParagraphProcessor.testa  r'  r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r3  d  s!     ( (- ( (t (r   c                	T   VP                  ^ 4      pVP                  4       '       Ed    V P                  P                  P	                  R4      '       d   V P                  V4      pVeF   VP                  '       d$   RP                  VP                  V4      Vn        R# RV,          Vn        R# VP                  '       d$   RP                  VP                  V4      Vn        R# VP                  4       Vn        R# \        P                  ! VR4      pVP                  4       Vn        R# R# )r   r   Nr   z
%sr   )r   rL   r,   r   r   r?   r   r   rB   r   r   r   )r6   r:   rd   r]   r   r   s   &&&   r   rg   ParagraphProcessor.rund  s    

1;;=={{  ((00 ..0&|||'/w||U'K'-~ {{{&.oofkk5&I&+lln $$VS17 r   r   Nr   r   r   r   r+   r+   ^  s    %( (r   r+   ) rn   
__future__r   loggingrv   xml.etree.ElementTreer   ElementTreetypingr   r   rH   r   blockparserr   markdownr   	getLoggerr   r-   r/   r"   r#   r)   r'   r(   r$   r%   r&   r!   r*   r+   r   r   r   <module>rA     s   ( #  	 % % %  $!			:	&"[ [|_. _D& &B(. (Vs^ sl	Q^ 	Q!B. !BH3N 3.(. (D. 6 :#( #(r   