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

309 lines
44 KiB
Plaintext
Raw Normal View History

Ë
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) dQdZ*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 ó6tj«}|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_inlinepatternsrP5ô&—]‘]“_€NØ×ÑÔ3´KÓ@À*ÈcÔ×ÑÔ1´)¸RÓ@À(ÈCÔ×ÑÔ4´\À2Ó ÐUXÔ×ÑÔ¸Ó<¸fÀcÔ×ÑÔÀÓCÀ\ÐSVÔ×ÑÜ%Ô&8¸=Ð?PÐRUôð×ÑÜ%¤l°BÓ7Ð9JÈCôð×ÑÜ*Ô+=¸rÓBÐDUÐWZôð×ÑÔ3´KÀÓDÀjÐRUÔ×ÑÔ3´KÀÓDÀjÐRUÔ×ÑÔÈÓMÈ{Ð\_Ô×ÑÔ¸Ó<¸fÀbÔ×ÑÔ/´ ¸È"Ô×ÑÔ5´mÓDÀlÐTVÔ×ÑÔ-¨eÓ4°kÀ2Ô×ÑÔÓ5°|ÀRÔ Ðó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؈|Ðàˆ
rQcó0eZdZUdZded<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ójeZdZUdZe«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Ô Ÿ7™7 5§>¡>Ó#3Ó
rQ©rLÚtreeprocessorsÚ
stashed_nodesÚKeyErrorrÚINLINE_PLACEHOLDER_REÚsub©rrÚtextrs @rOÚunescapezPattern.unescapesXø€ð Ø—G‘G×*¨8ÑBˆEô×)×-¨i¸Ó>øôò ØŠKð úsƒ#A Á AÁA©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ññ&*/«ÐÓð
 ØÓôó" ó 
ó?rQrhcó"eZdZdZdddZddZy)Ú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ÓÔðˆŒØˆ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—z9tuple[etree.Element | str | None, int | None, int | None]©rarbrcrdrsrzrfrQrOsñôô"
rQcóeZdZdZddZy)Ú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. é)rxs rOrzzSimpleTextPattern.handleMatchMsàw‰wqrQryr˜r—r^©rarbrcrdrzrfrQrOKs
ÙrQcóeZdZdZddZy)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)ÚstartÚendr s rOrzz%SimpleTextInlineProcessor.handleMatchTs'àw‰wqz˜1Ÿ7™7 1: q§u¡u¨Q£xÐ/rQryr˜r^r—ztuple[str, int, int]r¨rfrQrOrHrHRs
Ù0rQrHcóeZdZdZddZy)r3z Return an escaped character. cóL|jd«}||jjvrYdjtj
t
|«tj«|jd«|jd«fSd|jd«|jd«fS)
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)
rLÚ
ESCAPED_CHARSÚformatrÚSTXÚordÚETXr«)rrryÚchars rOrzz!EscapeInlineProcessor.handleMatch\swðw‰wq‹zˆØ 4—7‘7× —?‘?¤4§8¡8¬S°«Y¼¿¹ÓAÀ1Ç7Á7È1Ã:ÈqÏuÉuÐUVËxÐ ˜Ÿ  Q§U¡U¨1£XÐ -rQN)ryr˜r^r—ztuple[str | None, int, int]r¨rfrQrOr3r3Ys
Ù
.rQr3có eZdZdZddZddZy)ÚSimpleTagPatternz]
Return element of type `tag` with a text attribute of `group(3)`
of a Pattern.
có>tj||«||_y)
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]s rOrszSimpleTagPattern.__init__rsô ×ј˜wÔˆŒØ0rQcóptj|j«}|jd«|_|S)
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“)rrryÚels rOrzzSimpleTagPattern.handleMatchs*ô
]‰]˜4Ÿ8™8Ó
$ˆØ—''˜!“*ˆŒØˆ rQr]r^r^©ryr˜r—ú
etree.Elementr¢rfrQrOr¸r¸lsñó
rQr¸có eZdZdZddZddZy)ÚSimpleTagInlineProcessorz]
Return element of type `tag` with a text attribute of `group(2)`
of a Pattern.
có>tj||«||_y)
Create an instant of an simple tag processor.
Arguments:
pattern: A regular expression that matches a pattern.
tag: Tag of element.
N)rss rOrsz!SimpleTagInlineProcessor.__init__sô × Ñ   wÔˆŒØ0rQcó²tj|j«}|jd«|_||j d«|j
d«fS)
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“©rrrys rOrzz$SimpleTagInlineProcessor.handleMatchœsBô
]‰]˜4Ÿ8™8Ó
$ˆØ—''˜!“*ˆŒØ1—77˜1“:˜qŸu™u Q'rQNrÁ©ryr˜r^r—ztuple[etree.Element, int, int]r¢rfrQrOsñó
(rQcóeZdZdZddZy)Ú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¿rxs rOrzz SubstituteTagPattern.handleMatch¨sä}‰}˜TŸX™XÓ&rQNrÂrfrQrO¦s
Ù'rQcóeZdZdZddZy)rCcó‚tj|j«|jd«|j d«fS)r)r¿r s rOrzz(SubstituteTagInlineProcessor.handleMatch¯s,ä}‰}˜TŸX™XÓ¯©°«
°A·E±E¸!³HÐ<rQNrÉrfrQrOrCrC­s
Ù=rQrCcó eZdZdZddZddZy)r1zA Return a `<code>` element containing the escaped matching text. có¸tj||«djtjt d«tj «|_d|_y)Nr°úcode) rœrsrr´ÚESCAPED_BSLASHrº)rrr]s rOrsz BacktickInlineProcessor.__init__¶s=Ü× Ñ   &Ÿo™o¬d¯h©h¼¸D» Ä4Ç8Á8ÓÔØˆŒØ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.
rrz\\)
r¿rÚ AtomicStringÚ code_escapeÚstripr“ÚreplacerÕs rOrzz#BacktickInlineProcessor.handleMatch¼ð
7‰71Œ:ܘtŸx™xÓ(ˆ××(8Ñ(8¸¿¹À»×9IÑ9IÓ9KÓ(LÓMˆBŒGØq—ww˜q“z 1§5¡5¨£8Ð —7‘7˜1“:×% f¨d×.AÑ.AÓBÀAÇGÁGÈAÃJÐPQ×PUÑPUÐVWÓPXÐ XrQN)r]r^)ryr˜r^r—z$tuple[etree.Element | str, int, int]r¢rfrQrOr1r1´sÙ YrQr1cóeZdZdZddZy)Ú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)
Return [`Element`][xml.etree.ElementTree.Element] in following format:
`<tag1><tag2>group(3)</tag2>group(4)</tag2>` where `group(4)` is optional.
ú,r½éé)
Úsplitr¾r¿Ú
SubElementrƒr“ÚlenÚgroupsÚtail)rrryÚtag1Útag2Úel1Úel2s rOrzzDoubleTagPattern.handleMatchÓsoð —XX—^^ (‰
ˆˆdÜm‰m˜DÓÜ×јs DÓØ—7‘7˜1“:ˆŒÜ ˆqx‰x‹z‹?˜aÒ Ø—w‘w˜q“zˆCŒH؈
rQNrÂrfrQrOÍs ñô
rQcóeZdZdZddZy)ÚDoubleTagInlineProcessorrÝcój|jjd«\}}tj|«}tj||«}|j d«|_t|j««dk(r|j d«|_ ||jd«|jd«fS)
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“)rrrys rOrzz$DoubleTagInlineProcessor.handleMatchès‡ð —X‘X—^‘^ CÓ(‰
ˆˆdÜm‰m˜DÓÜ×јs DÓØ—7‘7˜1“:ˆŒÜ ˆqx‰x‹z‹?˜aÒ Ø—w‘w˜q“zˆCŒHØA—G‘G˜A“J §¡ Ð(rQNrÉrfrQrOâs ñô
)rQcó(eZdZdZddZddZddZy)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”rLÚ htmlStashÚstorer«)rrryÚrawhtmlÚ place_holders rOrzzHtmlInlineProcessor.handleMatchùsZà×)¨$¯-©-¸¿¹À»
Ó*CÓØ—w‘w×.¨wÓ Ø˜QŸW™W Q›Z¨¯©¨q«Ð1rQcó¾ jjdjŠdˆˆfd }tj
j
||«S#t$r|cYSwxYw)rr€cóÌ|jd«}j|«}|+ jjj |««Sy#t
$rd|zcYSwxYw)Nrz\%s)r„r”rLÚ
serializerÚ Exception)ryrˆr‰rrs €€rOrz/HtmlInlineProcessor.unescape.<locals>.get_stashsfø€Ø˜ˆBØ—I‘I˜b“MˆEØÐ ðŸ=™=¨¯©×);Ñ);¸EÓ)BÓ!øô! E™>Ò*ús§)AÁA#Á"A#rs` @rOr”zHtmlInlineProcessor.unescapeÿsXù€ð Ø—G‘G×*¨8Ñ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óHtt|jd«««S)Nr)ÚchrÚintrƒ)rys rOÚ _unescapez9HtmlInlineProcessor.backslash_unescape.<locals>._unescapesÜ”s˜1Ÿ7™7 1:“Ó 'rQ)rLrÚRErr)rrr“s rOz&HtmlInlineProcessor.backslash_unescapesOð Ø×
Ñ3×6ˆv‰vi Ó&øô
ò ØŠKð ús#;» A ÁA Nr­r™)rarbrcrdrzr”rfrQrOrErE÷sÙ ?ô&
'rQrEc óDeZdZdZeej 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
ZddZy)rJzGEmphasis processor for handling strong and em matches inside asterisks.Údoubleú strong,emú em,strongÚdouble2ÚsingleÚstrongÚemcóztj|«}|jd«}|j||d|«|S)zReturn single tag.r¦N)r¿Úparse_sub_patterns)rrryÚidxrér“s rOÚ build_singlezAsteriskProcessor.build_single+s6äm‰m˜ ˆØw‰wq‹zˆØ ×Ñ  c¨4°Ôˆ
rQcóp|jd«\}}tj|«}tj|«}|jd«}|j ||d|«|j |«t
|j««dk(r%|jd«}|j ||||«|S)zReturn double tag.rßNr½)r¿rÚappendrä© rrryr`r r“s rOÚ build_doublezAsteriskProcessor.build_double2s•ð—Z“_‰
ˆˆdÜm‰m˜DÓÜm‰m˜DÓØw‰wq‹zˆØ ×Ñ  c¨4°Ô
Ü ˆqx‰x‹z‹?˜aÒ Ø—7‘7˜1“:ˆDØ × # D¨#¨s°CÔ ˆ
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ßNr½)r¿rr r
s rOÚ
build_double2zAsteriskProcessor.build_double2@ð—Z“_‰
ˆˆdÜm‰m˜DÓÜm‰m˜DÓØw‰wq‹zˆØ ×Ñ  c¨4°Ôw‰wq‹zˆØ
Ø ×Ñ  c¨4°Ôˆ
rQcó2d}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)rjÚmatchÚ enumerateÚPATTERNSr]r“Ú
build_elementr_r`r )rrÚparentÚlastr ÚoffsetÚposÚlengthÚmatchedÚindexÚitemryr“s rOrz$AsteriskProcessor.parse_sub_patternsMs8ðˆØˆäT“ˆØFŠlà×Ñ×% d¨CÔä#,¨T¯]©]Ó#;ò'KE˜4à ’|Ø ØŸ ×*¨4°Ó5ð
$ F¨1¯7©7°1«:Ð6˜ÙØ/Ø,0 ¥ à.2 ¤ Ø!×°4·<±<ÀÇÁÈEÓR˜ØŸ
 !˜à'(§u¡u¨Q£xÐ/˜ Ø"&™ð+'ñ,à˜1Hq‘ðAF‹lðFFGˆ}ˆÙ ØÐØ • à" ð rQcóˆ|dk(r|j|||«S|dk(r|j|||«S|j|||«S)zElement builder.rr)rrr
)rrryr_r`rs rOrzAsteriskProcessor.build_elementŠsSð  Ø×% a¨¨uÓ
˜Ò
Ø×$ Q¨¨eÓ ×$ ¨eÓ 4rQcóDd}d}d}t|j«D]~\}}|jj||j d««}|sŒ4|j d«}|j d«}|j
||j|j|«}n|||fS)zParse patterns.Nr) rrr]rrr_r`) rrryrrÚm1s rOrzzAsteriskProcessor.handleMatch”s™ðˆØˆØˆä$ T§]¡]Ó ‰KˆE×# D¨!¯'©'°!«*Ó5ˆØŸ  Ø—f‘f˜Q“iØ×¨D¯L©L¸$¿)¹)ÀUÓKÙð
 ð5˜#ˆrQN)ryr˜r^r r—)ryr˜r`r^r r—)
r^rrzetree.Element | Noner r—ÚNone)
ryr˜r_r^r`r^rr—©ryr˜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Ù ZR—ZZ  ¨b¯i©i¸"¿*¹*Ñ.DÓEÀxÐQ\ÓZR—ZZ  ¨b¯i©i¸"¿*¹*Ñ.DÓEÀxÐQ\ÓZR—ZZ 
¨r¯y©y¸2¿:¹:Ñ/EÓFÈ ÐS^ÓZR—ZZ  ¨2¯9©9°r·z±zÑ+AÓBÀHÈhÓZR—Z‘Z  ¨R¯Y©Y¸¿¹Ñ-CÓDÀhÐPTÓ €HðPóó ó ð;ð;#Ø!.ð;#Ø6Jð;#ØQTð;
ó;#ózrQrJc óþ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¥Ù ZR—ZZ 
¨r¯y©y¸2¿:¹:Ñ/EÓÐR]ÓZR—ZZ 
¨r¯y©y¸2¿:¹:Ñ/EÓÐR]ÓZR—Z‘ZÐ 2°B·I±IÀÇ
Á
Ñ4JÓKÈYÐXcÓZR—Z‘Z °·±¸R¿Z¹ZÑ1GÓHÈ(ÐT\ÓZR—ZZÐ 1°2·9±9¸r¿z¹zÑ3IÓJÈHÐVZÓ €HðPrQrKcó eZdZdZej
dej ejz«Zej
d«Z ddZ
d dZ d
dZ 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ÚhrefÚtitle)ÚgetTextr¬ÚgetLinkr¾r¿r“Úsetr«) rrryr“rÚhandledr2r3s rOrzzLinkInlineProcessor.handleMatch·sà#Ÿ|™|¨D°!·%±%¸³(ÓˆˆeØ#à&*§l¡l°4¸Ó&?Ñ#ˆˆeU˜Ø
]‰]˜
ˆØˆŒà
ˆvà Ð Ø F‰F7˜ 1—77˜1“:˜$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