Files
intellecton/venv/lib/python3.12/site-packages/markdown/__pycache__/inlinepatterns.cpython-312.pyc
T

309 lines
44 KiB
Plaintext
Raw Normal View History

Ë
KÀj—–ãó—dZddlmZddlmZddlmZmZmZm Z ddl
Z
ddl m cm
Z ddlmZerddlmZdPd „Zd
Z d Z d Z d
Z dZ dZ dZ dZ dZ dZ dZ dZ dZ edzZ dZ! e Z" e!Z# dZ$ dZ% dZ& dZ' dZ( dZ) dQd„Z*Gd „d!e «Z+Gd"„d#«Z,Gd$„d%e,«Z-Gd&„d'e,«Z.Gd(„d)e-«Z/Gd*„d+e-«Z0Gd,„d-e,«Z1Gd.„d/e-«Z2Gd0„d1e1«Z3Gd2„d3e2«Z4Gd4„d5e-«Z5Gd6„d7e1«Z6Gd8„d9e2«Z7Gd:„d;e-«Z8Gd<„d=e-«Z9Gd>„d?e9«Z:Gd@„dAe-«Z;GdB„dCe;«Z<GdD„dEe;«Z=GdF„dGe=«Z>GdH„dIe=«Z?GdJ„dKe?«Z@GdL„dMe-«ZAGdN„dOe-«ZBy)RaB
In version 3.0, a new, more flexible inline processor was added, [`markdown.inlinepatterns.InlineProcessor`][]. The
original inline patterns, which inherit from [`markdown.inlinepatterns.Pattern`][] or one of its children are still
supported, though users are encouraged to migrate.
The new `InlineProcessor` provides two major enhancements to `Patterns`:
1. Inline Processors no longer need to match the entire block, so regular expressions no longer need to start with
`r'^(.*?)'` and end with `r'(.*?)%'`. This runs faster. The returned [`Match`][re.Match] object will only contain
what is explicitly matched in the pattern, and extension pattern groups now start with `m.group(1)`.
2. The `handleMatch` method now takes an additional input called `data`, which is the entire block under analysis,
not just what is matched with the specified pattern. The method now returns the element *and* the indexes relative
to `data` that the return element is replacing (usually `m.start(0)` and `m.end(0)`). If the boundaries are
returned as `None`, it is assumed that the match did not take place, and nothing will be altered in `data`.
This allows handling of more complex constructs than regular expressions can handle, e.g., matching nested
brackets, and explicit control of the span "consumed" by the processor.
é)Ú annotationsé)Úutil)Ú
TYPE_CHECKINGÚAnyÚ
CollectionÚ
NamedTupleN)Úentities)ÚMarkdownc ó6—tj«}|jtt«dd«|jt t |«dd«|jtt|«dd«|jtt|«dd«|jtt|«d d
«|jtt|«d d «|jtt|«d
d«|jt!t|«dd«|jt#t$|«dd«|jt't(|«dd«|jt+t,d«dd«|jt/t0|«dd«|jt/t2|«dd«|jt5t6«dd«|jt9d«dd «|jt;d!«d"d#«|S)$a
Build the default set of inline patterns for Markdown.
The order in which processors and/or patterns are applied is very important - e.g. if we first replace
`http://.../` links with `<a>` tags and _then_ try to replace inline HTML, we would end up with a mess. So, we
apply the expressions in the following order:
* backticks and escaped characters have to be handled before everything else so that we can preempt any markdown
patterns by escaping them;
* then we handle the various types of links (auto-links must be handled before inline HTML);
* then we handle inline HTML. At this point we will simply replace all inline HTML strings with a placeholder
and add the actual HTML to a stash;
* finally we apply strong, emphasis, etc.
Úbacktické¾Úescapeé´Ú referenceéªÚlinké Ú
image_linké–Úimage_referenceéŒÚshort_referenceé‚Úshort_image_refé}ÚautolinkéxÚautomailénÚbrÚ linebreakédÚhtmléZÚentityéPÚ
not_strongéFz\*Ú em_strongé<Ú_Ú
em_strong2é2)rÚRegistryÚregisterÚBacktickInlineProcessorÚ BACKTICK_REÚEscapeInlineProcessorÚ ESCAPE_REÚReferenceInlineProcessorÚ REFERENCE_REÚLinkInlineProcessorÚLINK_REÚImageInlineProcessorÚ
IMAGE_LINK_REÚImageReferenceInlineProcessorÚIMAGE_REFERENCE_REÚShortReferenceInlineProcessorÚ"ShortImageReferenceInlineProcessorÚAutolinkInlineProcessorÚ AUTOLINK_REÚAutomailInlineProcessorÚ AUTOMAIL_REÚSubstituteTagInlineProcessorÚ
LINE_BREAK_REÚHtmlInlineProcessorÚHTML_REÚ ENTITY_REÚSimpleTextInlineProcessorÚ
NOT_STRONG_REÚAsteriskProcessorÚUnderscoreProcessor)ÚmdÚkwargsÚinlinePatternss úZ/home/antigravity/intellecton/venv/lib/python3.12/site-packages/markdown/inlinepatterns.pyÚbuild_inlinepatternsrP5sÆ€ô&—]‘]“_€NØ×ÑÔ3´KÓ@À*ÈcÔRØ×ÑÔ1´)¸RÓ@À(ÈCÔPØ×ÑÔ4´\À2ÓFÈ ÐUXÔYØ×ÑÔ/´¸Ó<¸fÀcÔJØ×ÑÔ0´ÀÓCÀ\ÐSVÔWØ×ÑÜ%Ô&8¸"Ó=Ð?PÐRUôð×ÑÜ%¤l°BÓ7Ð9JÈCôð×ÑÜ*Ô+=¸rÓBÐDUÐWZôð×ÑÔ3´KÀÓDÀjÐRUÔVØ×ÑÔ3´KÀÓDÀjÐRUÔVØ×ÑÔ8¼ÈÓMÈ{Ð\_Ô`Ø×ÑÔ/´¸Ó<¸fÀbÔIØ×ÑÔ/´ ¸2Ó>ÀÈ"ÔMØ×ÑÔ5´mÓDÀlÐTVÔWØ×ÑÔ-¨eÓ4°kÀ2ÔFØ×ÑÔ/°Ó5°|ÀRÔHØ Ðóz(?<!\!)z;(?:(?<!\\)((?:\\{2})+)(?=`+)|(?<!\\)(`+)(.+?)(?<!`)\2(?!`))z\\(.)z(\*)([^\*]+)\1z(\*{2})(.+?)\1z%(?<!\w)(_{2})(?!_)(.+?)(?<!_)\1(?!\w)z"(?<!\w)(_)(?!_)(.+?)(?<!_)\1(?!\w)z7(?<!\w)(\_)\1(?!\1)(.+?)(?<!\w)\1(?!\1)(.+?)\1{3}(?!\w)z(\*)\1{2}(.+?)\1(.*?)\1{2}z(_)\1{2}(.+?)\1(.*?)\1{2}z(\*)\1{2}(.+?)\1{2}(.*?)\1z(_)\1{2}(.+?)\1{2}(.*?)\1z&(\*)\1(?!\1)([^*]+?)\1(?!\1)(.+?)\1{3}z\[z\!\[z%((^|(?<=\s))(\*{1,3}|_{1,3})(?=\s|$))z+<((?:[Ff]|[Hh][Tt])[Tt][Pp][Ss]?://[^<>]*)>z<([^<> !]+@[^@<> ]+)>z(<(\/?[a-zA-Z][^<>@ ]*( [^<>]*)?|!--(?:(?!<!--|-->).)*--|[?](?:(?!<[?]|[?]>).)*[?]|!\[CDATA\[(?:(?!<!\[CDATA\[|\]\]>).)*\]\])>)z-(&(?:\#[0-9]+|\#x[0-9a-fA-F]+|[a-zA-Z0-9]+);)z \ncó˜—|jd«r|jd«s"|jd«r|jd«r|ddS|S)z#Remove quotes from around a string.ú"ú'réÿÿÿÿ)Ú
startswithÚendswith)Ústrings rOÚdequoterY±sE€à × Ñ ˜3Ô  F§O¡O°CÔ$8Ø×ј#Ô 6§?¡?°3Ô#7Ø�a˜ˆ|Ðàˆ
rQcó0—eZdZUdZded<ded<ded<y)Ú EmStrongItemzEmphasis/strong pattern item.úre.Pattern[str]ÚpatternÚstrÚbuilderÚtagsN)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú__annotations__©rQrOr[r[ºs…Ù'Ø
ÓØ
ƒLØ
„IrQr[cój—eZdZUdZe«Zded< ded<ded<ddd „Zdd
„Zdd „Z dd „Z
dd
„Z y)ÚPatternaí
Base class that inline patterns subclass.
Inline patterns are handled by means of `Pattern` subclasses, one per regular expression.
Each pattern object uses a single regular expression and must support the following methods:
[`getCompiledRegExp`][markdown.inlinepatterns.Pattern.getCompiledRegExp] and
[`handleMatch`][markdown.inlinepatterns.Pattern.handleMatch].
All the regular expressions used by `Pattern` subclasses must capture the whole block. For this
reason, they all start with `^(.*)` and end with `(.*)!`. When passing a regular expression on
class initialization, the `^(.*)` and `(.*)!` are added automatically and the regular expression
is pre-compiled.
It is strongly suggested that the newer style [`markdown.inlinepatterns.InlineProcessor`][] that
use a more efficient and flexible search approach be used instead. However, the older style
`Pattern` remains for backward compatibility with many existing third-party extensions.
zCollection[str]ÚANCESTOR_EXCLUDESr\Ú compiled_reúMarkdown | NonerLNcóš—||_tjd|ztjtjz«|_||_y)a!
Create an instant of an inline pattern.
Arguments:
pattern: A regular expression that matches a pattern.
md: An optional pointer to the instance of `markdown.Markdown` and is available as
`self.md` on the class instance.
z
^(.*?)%s(.*)$N)r]ÚreÚcompileÚDOTALLÚUNICODErjrL©Úselfr]rLs rOÚ__init__zPattern.__init__âs=€ðˆŒ ÜŸ:™:Ð&6¸Ñ&@Ü&(§i¡i´"·*±*Ñ&<ó>ˆÔðˆ�rQcó—|jS)z' Return a compiled regular expression. )rj©rrs rOÚgetCompiledRegExpzPattern.getCompiledRegExpós€à×ÑÐrQcó—y)zóReturn a ElementTree element from the given match.
Subclasses should override this method.
Arguments:
m: A match object containing a match of the pattern.
Returns: An ElementTree Element object.
Nrf©rrÚms rOÚ handleMatchzPattern.handleMatch÷s€ð
rQcó.—|jjS)z+ Return class name, to define pattern type )Ú __class__rarus rOÚtypez Pattern.types€à�~‰~×&Ñ&Ð&rQc󸇗 |jjdjŠˆfd„}tj
j
||«S#t$r|cYSwxYw)ú> Return unescaped text given text with an inline placeholder. Úinlinecó´•—|jd«}|‰vrB‰j|«}t|t«r|Sdj |j ««Sy)NrÚ)ÚgroupÚgetÚ
isinstancer^ÚjoinÚitertext)ryÚidÚvalueÚstashs €rOÚ get_stashz#Pattern.unescape.<locals>.get_stashsPø€Ø—‘˜“ˆBØ�U‰{ØŸ ™  "›
�ܘe¤SÔ)Ø �LðŸ7™7 5§>¡>Ó#3Ó4Ð4ð
rQ©rLÚtreeprocessorsÚ
stashed_nodesÚKeyErrorrÚINLINE_PLACEHOLDER_REÚsub©rrÚtextr‹rŠs @rOÚunescapezPattern.unescapesXø€ð Ø—G‘G×*Ñ*¨8Ñ4×BÑBˆEô 5ô×)Ñ)×-Ñ-¨i¸Ó>Ð>øôò ØŠKð úsƒ#A Á AÁA©N©r]r^rLrk)Úreturnz
re.Pattern)ryú
re.Match[str]r—zetree.Element | str)r—r^©r“r^r—r^) rarbrcrdÚtuplerirersrvrzr}r”rfrQrOrhrhÅsB…ññ&*/«Ð�Ó0ðð
!Ó ØÓôó" ó 
ó'ô?rQrhcó"—eZdZdZddd„Zdd„Zy)ÚInlineProcessorz¡
Base class that inline processors subclass.
This is the newer style inline processor that uses a more
efficient and flexible search approach.
Ncó¢—||_tj|tjtjz«|_d|_||_y)a"
Create an instant of an inline processor.
Arguments:
pattern: A regular expression that matches a pattern.
md: An optional pointer to the instance of `markdown.Markdown` and is available as
`self.md` on the class instance.
FN)r]rmrnrorprjÚ safe_moderLrqs rOrszInlineProcessor.__init__$s;€ðˆŒ ÜŸ:™: g¬r¯y©y¼2¿:¹:Ñ/EÓFˆÔðˆŒØˆ�rQcó—y)a™Return a ElementTree element from the given match and the
start and end index of the matched text.
If `start` and/or `end` are returned as `None`, it will be
assumed that the processor did not find a valid region of text.
Subclasses should override this method.
Arguments:
m: A re match object containing a match of the pattern.
data: The buffer currently under analysis.
Returns:
el: The ElementTree element, text or None.
start: The start of the region that has been matched or None.
end: The end of the region that has been matched or None.
Nrf©rrryÚdatas rOrzzInlineProcessor.handleMatch5s€ð&
rQr•r–)ryr˜r¡r^r—z9tuple[etree.Element | str | None, int | None, int | None]©rarbrcrdrsrzrfrQrOrœrœs„ñôô"
rQrœcó—eZdZdZdd„Zy)ÚSimpleTextPatternz2 Return a simple text of `group(2)` of a Pattern. có$—|jd«S)z< Return string content of `group(2)` of a matching pattern. é)rƒrxs rOrzzSimpleTextPattern.handleMatchMs€à�w‰w�q‹zÐrQN©ryr˜r—r^©rarbrcrdrzrfrQrOr¤r¤Ks
„Ù<ôrQr¤có—eZdZdZdd„Zy)rHz2 Return a simple text of `group(1)` of a Pattern. cóf—|jd«|jd«|jd«fS)z< Return string content of `group(1)` of a matching pattern. rr)rƒÚstartÚendr s rOrzz%SimpleTextInlineProcessor.handleMatchTs'€à�w‰w�q‹z˜1Ÿ7™7 1›: q§u¡u¨Q£xÐ/Ð/rQN©ryr˜r¡r^r—ztuple[str, int, int]r¨rfrQrOrHrHRs
„Ù<ô0rQrHcó—eZdZdZdd„Zy)r3z Return an escaped character. cóL—|jd«}||jjvrYdjtj
t
|«tj«|jd«|jd«fSd|jd«|jd«fS)aµ
If the character matched by `group(1)` of a pattern is in [`ESCAPED_CHARS`][markdown.Markdown.ESCAPED_CHARS]
then return the integer representing the character's Unicode code point (as returned by [`ord`][]) wrapped
in [`util.STX`][markdown.util.STX] and [`util.ETX`][markdown.util.ETX].
If the matched character is not in [`ESCAPED_CHARS`][markdown.Markdown.ESCAPED_CHARS], then return `None`.
rú{}{}{}rN)
rƒrLÚ
ESCAPED_CHARSÚformatrÚSTXÚordÚETXr«r¬)rrryr¡Úchars rOrzz!EscapeInlineProcessor.handleMatch\sw€ð�w‰w�q‹zˆØ �4—7‘7×(Ñ(Ñ (Ø—?‘?¤4§8¡8¬S°«Y¼¿¹ÓAÀ1Ç7Á7È1Ã:ÈqÏuÉuÐUVËxÐWÐ Wà˜Ÿ™ › Q§U¡U¨1£XÐ-Ð -rQN)ryr˜r¡r^r—ztuple[str | None, int, int]r¨rfrQrOr3r3Ys
„Ù(ô
.rQr3có —eZdZdZdd„Zdd„Zy)ÚSimpleTagPatternz]
Return element of type `tag` with a text attribute of `group(3)`
of a Pattern.
có>—tj||«||_y)zµ
Create an instant of an simple tag pattern.
Arguments:
pattern: A regular expression that matches a pattern.
tag: Tag of element.
N)rhrsÚtag©rrr]rºs rOrszSimpleTagPattern.__init__rs€ô ×ј˜wÔ'؈ŒØ0rQcóp—tj|j«}|jd«|_|S)z¤
Return [`Element`][xml.etree.ElementTree.Element] of type `tag` with the string in `group(3)` of a
matching pattern as the Element's text.
é)ÚetreeÚElementrºrƒr“)rrryÚels rOrzzSimpleTagPattern.handleMatchs*€ô
�]‰]˜4Ÿ8™8Ó
$ˆØ—'‘'˜!“*ˆŒØˆ rQN©r]r^rºr^©ryr˜r—ú
etree.Elementr¢rfrQrOr¸r¸ls„ñó
1ôrQr¸có —eZdZdZdd„Zdd„Zy)ÚSimpleTagInlineProcessorz]
Return element of type `tag` with a text attribute of `group(2)`
of a Pattern.
có>—tj||«||_y)z·
Create an instant of an simple tag processor.
Arguments:
pattern: A regular expression that matches a pattern.
tag: Tag of element.
N)rœrsrºr»s rOrsz!SimpleTagInlineProcessor.__init__�s€ô × Ñ   wÔ/؈ŒØ0rQcó²—tj|j«}|jd«|_||j d«|j
d«fS)z¤
Return [`Element`][xml.etree.ElementTree.Element] of type `tag` with the string in `group(2)` of a
matching pattern as the Element's text.
r¦r)r¾r¿rºrƒr“r«r¬©rrryr¡rÀs rOrzz$SimpleTagInlineProcessor.handleMatchœsB€ô
�]‰]˜4Ÿ8™8Ó
$ˆØ—'‘'˜!“*ˆŒØ�1—7‘7˜1“:˜qŸu™u Q›xÐ'Ð'rQNrÁ©ryr˜r¡r^r—ztuple[etree.Element, int, int]r¢rfrQrOrÅrʼns„ñó
1ô(rQrÅcó—eZdZdZdd„Zy)ÚSubstituteTagPatternú3 Return an element of type `tag` with no children. có@—tj|j«S)úH Return empty [`Element`][xml.etree.ElementTree.Element] of type `tag`. )r¾r¿rºrxs rOrzz SubstituteTagPattern.handleMatch¨s€ä�}‰}˜TŸX™XÓ&Ð&rQNrÂr¨rfrQrOrËr˦s
„Ù=ô'rQrËcó—eZdZdZdd„Zy)rCrÌcó‚—tj|j«|jd«|j d«fS)rÎr)r¾r¿rºr«r¬r s rOrzz(SubstituteTagInlineProcessor.handleMatch¯s,€ä�}‰}˜TŸX™XÓ&¨¯©°«
°A·E±E¸!³HÐ<Ð<rQNrÉr¨rfrQrOrCrC­s
„Ù=ô=rQrCcó —eZdZdZdd„Zdd„Zy)r1zA Return a `<code>` element containing the escaped matching text. có¸—tj||«djtjt d«tj «|_d|_y)Nr°ú\Úcode) rœrsr²rr³r´rµÚESCAPED_BSLASHrº)rrr]s rOrsz BacktickInlineProcessor.__init__¶s=€Ü× Ñ   wÔ/Ø&Ÿo™o¬d¯h©h¼¸D» Ä4Ç8Á8ÓLˆÔ؈ŒØ0rQcóÔ—|jd«rŒtj|j«}t j
t j |jd«j«««|_||jd«|jd«fS|jd«jd|j«|jd«|jd«fS)a€
If the match contains `group(3)` of a pattern, then return a `code`
[`Element`][xml.etree.ElementTree.Element] which contains HTML escaped text (with
[`code_escape`][markdown.util.code_escape]) as an [`AtomicString`][markdown.util.AtomicString].
If the match does not contain `group(3)` then return the text of `group(1)` backslash escaped.
r½rrz\\)
rƒr¾r¿rºrÚ AtomicStringÚ code_escapeÚstripr“r«r¬ÚreplacerÕrÈs rOrzz#BacktickInlineProcessor.handleMatch¼s©€ð
�7‰7�1Œ:Ü—‘˜tŸx™xÓ(ˆBÜ×'Ñ'¬×(8Ñ(8¸¿¹À»×9IÑ9IÓ9KÓ(LÓMˆBŒGØ�q—w‘w˜q“z 1§5¡5¨£8Ð+Ð +à—7‘7˜1“:×%Ñ% f¨d×.AÑ.AÓBÀAÇGÁGÈAÃJÐPQ×PUÑPUÐVWÓPXÐXÐ XrQN)r]r^)ryr˜r¡r^r—z$tuple[etree.Element | str, int, int]r¢rfrQrOr1r1´s„ÙKó1ô YrQr1có—eZdZdZdd„Zy)ÚDoubleTagPatternúfReturn a ElementTree element nested in tag2 nested in tag1.
Useful for strong emphasis etc.
có(—|jjd«\}}tj|«}tj||«}|j d«|_t|j««dk(r|j d«|_ |S)z¬
Return [`Element`][xml.etree.ElementTree.Element] in following format:
`<tag1><tag2>group(3)</tag2>group(4)</tag2>` where `group(4)` is optional.
ú,r½éé)
rºÚsplitr¾r¿Ú
SubElementrƒr“ÚlenÚgroupsÚtail)rrryÚtag1Útag2Úel1Úel2s rOrzzDoubleTagPattern.handleMatchÓso€ð —X‘X—^‘^ CÓ(‰
ˆˆdÜ�m‰m˜DÓ!ˆÜ×јs DÓ)ˆØ—7‘7˜1“:ˆŒÜ ˆq�x‰x‹z‹?˜aÒ Ø—w‘w˜q“zˆCŒH؈
rQNrÂr¨rfrQrOrÜrÜÍs „ñô
rQrÜcó—eZdZdZdd„Zy)ÚDoubleTagInlineProcessorrÝcój—|jjd«\}}tj|«}tj||«}|j d«|_t|j««dk(r|j d«|_ ||jd«|jd«fS)z¬
Return [`Element`][xml.etree.ElementTree.Element] in following format:
`<tag1><tag2>group(2)</tag2>group(3)</tag2>` where `group(3)` is optional.
rßr¦r½r) rºrâr¾r¿rãrƒr“rärårær«r¬)rrryr¡rçrèrérês rOrzz$DoubleTagInlineProcessor.handleMatchès‡€ð —X‘X—^‘^ CÓ(‰
ˆˆdÜ�m‰m˜DÓ!ˆÜ×јs DÓ)ˆØ—7‘7˜1“:ˆŒÜ ˆq�x‰x‹z‹?˜aÒ Ø—w‘w˜q“zˆCŒHØ�A—G‘G˜A“J §¡ a£Ð(Ð(rQNrÉr¨rfrQrOrìrìâs „ñô
)rQrìcó(—eZdZdZdd„Zdd„Zdd„Zy)rEz1 Store raw inline html and return a placeholder. cóð—|j|j|jd«««}|jjj |«}||j
d«|jd«fS)zL Store the text of `group(1)` of a pattern and return a placeholder string. rr)Úbackslash_unescaper”rƒrLÚ htmlStashÚstorer«r¬)rrryr¡ÚrawhtmlÚ place_holders rOrzzHtmlInlineProcessor.handleMatchùsZ€à×)Ñ)¨$¯-©-¸¿¹À»
Ó*CÓDˆØ—w‘w×(Ñ(×.Ñ.¨wÓ7ˆ ؘQŸW™W Q›Z¨¯©¨q«Ð1Ð1rQc󾇇— ‰jjdjŠdˆˆfd„ }tj
j
||«S#t$r|cYSwxYw)rr€cóÌ•—|jd«}‰j|«}|�+ ‰j‰jj |««Sy#t
$rd|zcYSwxYw)Nrz\%s)rƒr„r”rLÚ
serializerÚ Exception)ryrˆr‰rrrŠs €€rOr‹z/HtmlInlineProcessor.unescape.<locals>.get_stashsfø€Ø—‘˜“ˆBØ—I‘I˜b“MˆEØÐ ð*àŸ=™=¨¯©×);Ñ);¸EÓ)BÓCÐCð!øô!ò*Ø! E™>Ò)ð*ús§)AÁA#Á"A#r§rŒr’s` @rOr”zHtmlInlineProcessor.unescapeÿsXù€ð Ø—G‘G×*Ñ*¨8Ñ4×BÑBˆEö *ô×)Ñ)×-Ñ-¨i¸Ó>Ð>øôò ØŠKð ús„#AÁ AÁAcó˜— |jjdj}dd„}|j ||«S#t$r|cYSwxYw)zG Return text with backslash escapes undone (backslashes are restored). r”cóH—tt|jd«««S)Nr)ÚchrÚintrƒ)rys rOÚ _unescapez9HtmlInlineProcessor.backslash_unescape.<locals>._unescapes€Ü”s˜1Ÿ7™7 1›:“Ó'Ð 'rQr§)rLr�ÚREr�r‘)rrr“rþrýs rOrðz&HtmlInlineProcessor.backslash_unescapesO€ð Ø—‘×'Ñ'¨
Ñ3×6Ñ6ˆBó (ð�v‰v�i Ó&Ð&øô
ò ØŠKð ús‚#;» A ÁA Nr­r™)rarbrcrdrzr”rðrfrQrOrErE÷s„Ù;ó2ó ?ô&
'rQrEc óD—eZdZdZeej eejejz«dd«eej e
ejejz«dd«eej e ejejz«dd«eej e ejejz«dd«eej e
ejejz«dd«gZ dd „Zdd
„Zdd „Z dd „Zdd
„Zdd„Zy)rJzGEmphasis processor for handling strong and em matches inside asterisks.Údoubleú strong,emú em,strongÚdouble2ÚsingleÚstrongÚemcóz—tj|«}|jd«}|j||d|«|S)zReturn single tag.r¦N)r¾r¿rƒÚparse_sub_patterns)rrryrºÚidxrér“s rOÚ build_singlezAsteriskProcessor.build_single+s6€ä�m‰m˜CÓ ˆØ�w‰w�q‹zˆØ ×Ñ  c¨4°Ô5؈
rQcóp—|jd«\}}tj|«}tj|«}|jd«}|j ||d|«|j |«t
|j««dk(r%|jd«}|j ||||«|S)zReturn double tag.rßr¦Nr½)râr¾r¿rƒrÚappendrärå© rrryr`r rçrèrérêr“s rOÚ build_doublezAsteriskProcessor.build_double2s•€ð—Z‘Z “_‰
ˆˆdÜ�m‰m˜DÓ!ˆÜ�m‰m˜DÓ!ˆØ�w‰w�q‹zˆØ ×Ñ  c¨4°Ô5Ø �
‰
�3ŒÜ ˆq�x‰x‹z‹?˜aÒ Ø—7‘7˜1“:ˆDØ × #Ñ # D¨#¨s°CÔ 8؈
rQcó8—|jd«\}}tj|«}tj|«}|jd«}|j ||d|«|jd«}|j |«|j ||d|«|S)zFReturn double tags (variant 2): `<strong>text <em>text</em></strong>`.rßr¦Nr½)râr¾r¿rƒrr r
s rOÚ
build_double2zAsteriskProcessor.build_double2@sƒ€ð—Z‘Z “_‰
ˆˆdÜ�m‰m˜DÓ!ˆÜ�m‰m˜DÓ!ˆØ�w‰w�q‹zˆØ ×Ñ  c¨4°Ô5Ø�w‰w�q‹zˆØ �
‰
�3ŒØ ×Ñ  c¨4°Ô5؈
rQcó2—d}d}t|«}||krê|jj||«rÃd}t|j«D]¡\} }
| |krŒ |
j
j||«} | sŒ+||| j
d«} | r|�| |_n| |_|j| |
j|
j| «}
|j|
«|
}| jd«x}}d}Œ£|s |dz
}n|dz
}||krŒê||d} | r|�| |_y| |_yy)a/
Parses sub patterns.
`data`: text to evaluate.
`parent`: Parent to attach text and sub elements to.
`last`: Last appended child to parent. Can also be None if parent has no children.
`idx`: Current pattern index that was used to evaluate the parent.
rFNTr)rärjÚmatchÚ enumerateÚPATTERNSr]r«rær“Ú
build_elementr_r`r r¬)rrr¡ÚparentÚlastr ÚoffsetÚposÚlengthÚmatchedÚindexÚitemryr“rÀs rOrz$AsteriskProcessor.parse_sub_patternsMs8€ðˆØˆä�T“ˆØ�FŠlà×Ñ×%Ñ% d¨CÔ0Ø�ä#,¨T¯]©]Ó#;ò'‘K�E˜4à ’|Ø ØŸ ™ ×*Ñ*¨4°Ó5�AÚð
$ F¨1¯7©7°1«:Ð6˜ÙØ#Ð/Ø,0 ¥ à.2 ¤ Ø!×/Ñ/°°4·<±<ÀÇÁÈEÓR˜ØŸ
™
 bÔ)Ø!˜à'(§u¡u¨Q£xÐ/˜ Ø"&™ð+'ñ,à˜1‘H‘Cð�q‘�ðA�F‹lðF�F�Gˆ}ˆÙ ØÐØ �• à"�• ð rQcóˆ—|dk(r|j|||«S|dk(r|j|||«S|j|||«S)zElement builder.rr)rrr
)rrryr_r`rs rOrzAsteriskProcessor.build_elementŠsS€ð �iÒ Ø×%Ñ% a¨¨uÓ5Ð 5Ø
˜Ò
Ø×$Ñ$ Q¨¨eÓ4Ð 4à×$Ñ$ Q¨¨eÓ4Ð 4rQcóD—d}d}d}t|j«D]~\}}|jj||j d««}|sŒ4|j d«}|j d«}|j
||j|j|«}n|||fS)zParse patterns.Nr) rrr]rr«r¬rr_r`) rrryr¡rÀr«r¬rrÚm1s rOrzzAsteriskProcessor.handleMatch”s™€ðˆØˆØˆä$ T§]¡]Ó3ò ‰KˆE�4Ø—‘×#Ñ# D¨!¯'©'°!«*Ó5ˆBÚØŸ™ › �Ø—f‘f˜Q“i�Ø×'Ñ'¨¨D¯L©L¸$¿)¹)ÀUÓK�Ùð
 ð�5˜#ˆ~ÐrQN)ryr˜rºr^r rür—rÃ)ryr˜r`r^r rür—rÃ)
r¡r^rrÃrzetree.Element | Noner rür—ÚNone)
ryr˜r_r^r`r^rrür—réryr˜r¡r^r—z3tuple[etree.Element | None, int | None, int | None])rarbrcrdr[rmrnÚ EM_STRONG_RErorpÚ STRONG_EM_REÚ
STRONG_EM3_REÚ STRONG_REÚ EMPHASIS_RErr
rrrrrzrfrQrOrJrJs„ÙQñ �Z�R—Z‘Z  ¨b¯i©i¸"¿*¹*Ñ.DÓEÀxÐQ\Ó]Ù�Z�R—Z‘Z  ¨b¯i©i¸"¿*¹*Ñ.DÓEÀxÐQ\Ó]Ù�Z�R—Z‘Z 
¨r¯y©y¸2¿:¹:Ñ/EÓFÈ ÐS^Ó_Ù�Z�R—Z‘Z  ¨2¯9©9°r·z±zÑ+AÓBÀHÈhÓWÙ�Z�R—Z‘Z  ¨R¯Y©Y¸¿¹Ñ-CÓDÀhÐPTÓUð €HðPóó ó ð;#Øð;#Ø!.ð;#Ø6Jð;#ØQTð;#à
ó;#óz5ôrQrJc óþ—eZdZdZeej eejejz«dd«eej e
ejejz«dd«eej e ejejz«dd«eej e ejejz«dd«eej e
ejejz«dd«gZy )
rKzIEmphasis processor for handling strong and em matches inside underscores.rrrrrrrN)rarbrcrdr[rmrnÚ
EM_STRONG2_RErorpÚ
STRONG_EM2_REÚSMART_STRONG_EM_REÚSMART_STRONG_REÚSMART_EMPHASIS_RErrfrQrOrKrK¥sÙ„ÙSñ �Z�R—Z‘Z 
¨r¯y©y¸2¿:¹:Ñ/EÓFÈÐR]Ó^Ù�Z�R—Z‘Z 
¨r¯y©y¸2¿:¹:Ñ/EÓFÈÐR]Ó^Ù�Z�R—Z‘ZÐ 2°B·I±IÀÇ
Á
Ñ4JÓKÈYÐXcÓdÙ�Z�R—Z‘Z °·±¸R¿Z¹ZÑ1GÓHÈ(ÐT\Ó]Ù�Z�R—Z‘ZÐ 1°2·9±9¸r¿z¹zÑ3IÓJÈHÐVZÓ[ð €HðPrQrKcó —eZdZdZej
dej ejz«Zej
d«Z dd„Z
d d„Z d
d„Z y) r7z- Return a link element from the given match. z2\(\s*(?:(<[^<>]*>)\s*(?:('[^']*'|"[^"]*")\s*)?\))?z\scó2—|j||jd««\}}}|sy|j||«\}}}}|sytjd«}||_|j
d|«|�|j
d|«||jd«|fS)zS Return an `a` [`Element`][xml.etree.ElementTree.Element] or `(None, None, None)`. r©NNNÚaÚhrefÚtitle)ÚgetTextr¬ÚgetLinkr¾r¿r“Úsetr«) rrryr¡r“rÚhandledr2r3rÀs rOrzzLinkInlineProcessor.handleMatch·s’€à#Ÿ|™|¨D°!·%±%¸³(Ó;шˆe�WáØ#à&*§l¡l°4¸Ó&?Ñ#ˆˆe�U˜GÙØ#ä
�]‰]˜3Ó
ˆØˆŒà
�‰ˆv�tÔà Ð Ø �F‰F�7˜EÔ "à�1—7‘7˜1“:˜uÐ$Ð$rQc ó¾—d}d}d}|jj||¬«}|rm|jd«r\|jd«ddj«}|jd«r|jd«dd}|j d«}d }�nc|�r`d}d}|j «} | }d}
d} d} d}
d}d}d}d}d}t |t
|««D�]}||}|d
k(r|s|dz