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

102 lines
20 KiB
Plaintext
Raw Normal View History

Ë
KÀjÔCãó—dZddlmZddlZddlZddlZddlmZm Z erddl
m Z ejd«Z
ejjd«Zejj#e«Zej&j)e«eej*d<ejd «e_ejd
«e_ejd «e_ejd «e_ej2e_ejd
ej6«e_ejdej6«e_ejd«ZGd„dej>«Z e e_Gd„dej>«Z!y)a 
This module imports a copy of [`html.parser.HTMLParser`][] and modifies it heavily through monkey-patches.
A copy is imported rather than the module being directly imported as this ensures that the user can import
and use the unmodified library for their own needs.
é)Ú annotationsN)Ú
TYPE_CHECKINGÚSequence)ÚMarkdownz--!?>z html.parserÚ
htmlparserz
<[a-zA-Z]|</>z </[a-zA-Z]?z\?>z&([a-zA-Z][-.a-zA-Z0-9]*);a”
<[a-zA-Z][^`\t\n\r\f />\x00]* # tag name <= added backtick here
(?:[\s/]* # optional whitespace before attribute name
(?:(?<=['"\s/])[^`\s/>][^\s/=>]* # attribute name <= added backtick here
(?:\s*=+\s* # value indicator
(?:'[^']*' # LITA-enclosed value
|"[^"]*" # LIT-enclosed value
|(?!['"])[^`>\s]* # bare value <= added backtick here
)
(?:\s*,)* # possibly followed by a comma
)?(?:\s|/(?!>))*
)*
)?
\s* # trailing whitespace
a
[a-zA-Z][^`\t\n\r\f />]* # tag name
[\t\n\r\f /]* # optional whitespace before attribute name
(?:(?<=['"\t\n\r\f /])[^`\t\n\r\f />][^\t\n\r\f /=>]* # attribute name
(?:= # value indicator
(?:'[^']*' # LITA-enclosed value
|"[^"]*" # LIT-enclosed value
|(?!['"])[^>\t\n\r\f ]* # bare value
)
)?
[\t\n\r\f /]* # possibly followed by a space
)*
>?
z ^([ ]*\n){2}có.‡—eZdZdZˆfd„Zdˆfd„ ZˆxZS)Ú _HTMLParserz"Handle special start and end tags.cóþ•—|j||dz}t|d«}t|«dksd|cxkrdks5nd|cxkrdks(n|j|j||dz«|dzSt‰|�|«S)NééÿÿÿÿéAéZéaézé)ÚrawdataÚordÚlenÚ handle_dataÚsuperÚ parse_endtag)ÚselfÚiÚstartÚcÚ __class__s €úV/home/antigravity/intellecton/venv/lib/python3.12/site-packages/markdown/htmlparser.pyrz_HTMLParser.parse_endtagcsyø€Ø— ‘ ˜Q˜q ™sÐ#ˆÜ ��b‘ ‹NˆÜ ˆu‹:˜Š> "¨¤-¨R¤-°2¸´>¸c´>Ø × Ñ ˜TŸ\™\¨!¨A°©EÐ2Ô 3Ø�q‘5ˆL܉wÑ# AÓ&Ð&óc󘕗|j||dzdk(r&|j|j||dz«|dzSt‰|�
|«S)Nr ú</>)rrrÚparse_starttag©rrrs €rr!z_HTMLParser.parse_starttagksPø€à �<‰<˜˜!˜a™%Ð  EÒ )Ø × Ñ ˜TŸ\™\¨!¨A°©EÐ2Ô 3Ø�q‘5ˆLä‰wÑ% aÓ(Ð(r©rÚintÚreturnr$)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rr!Ú
__classcell__©rs@rr r `sø„Ù,ô'÷)ñ)rr có‡—eZdZUdZdˆfd„ Zˆfd„Zˆfd„Zedd„«Zdd„Z dd„Z
d d„Z d!d „Z d"d
„Z
d#d „Zd!d „Zd$d
„Zd$d„Zd"d„Zd"d„Zd"d„Zd"d„Zd%ˆfd„ Zd&d„Zd%ˆfd„ Zd'd(ˆfd„
ZdZded<d)d„Zd%d„ZˆxZS)*Ú
HTMLExtractorzû
Extract raw HTML from text.
The raw HTML is stored in the [`htmlStash`][markdown.util.HtmlStash] of the
[`Markdown`][markdown.Markdown] instance passed to `md` and the remaining text
is stored in `cleandoc` as a list of strings.
cóv•—d|vrd|d<tdg«|_dg|_t‰|�|i|¤Ž||_y)NÚconvert_charrefsFÚhrr)ÚsetÚ
empty_tagsÚlineno_start_cacherÚ__init__Úmd)rr5ÚargsÚkwargsrs €rr4zHTMLExtractor.__init__�sJø€Ø  VÑ +Ø).ˆFÐ%Ñ &ô˜t˜f›+ˆŒà#$ #ˆÔô ‰Ñ˜$Ð) &Ò)؈�rcóx•—d|_d|_g|_g|_g|_dg|_t ‰|�«y)z1Reset this instance. Loses all unprocessed data.FrN)ÚinrawÚintailÚstackÚ_cacheÚcleandocr3rÚreset©rrs €rr>zHTMLExtractor.resetŽs9ø€àˆŒ
؈Œ Ø "ˆŒ
Ø!#ˆŒ Ø#%ˆŒ
Ø#$ #ˆÔä
‰‰
�rcóø•—t‰|�«t|j«rb|jr;|j
s/|j
tj|j««n|j
|j«t|j«r_|jj|jjjdj|j«««g|_ yy)zHandle any buffered data.ÚN)rÚcloserrr/Ú
cdata_elemrrÚunescaper<r=Úappendr5Ú htmlStashÚstoreÚjoinr?s €rrBzHTMLExtractor.close™s¤ø€ä
‰‰
ŒÜ ˆt�|‰|Ô ð×$Ò$¨T¯_ª_Ø× Ñ ¤×!4Ñ!4°T·\±\Ó!BÕCà× Ñ  §¡Ô.ä ˆt�{‰{Ô Ø �M‰M× Ñ  §¡×!2Ñ!2×!8Ñ!8¸¿¹ÀÇÁÓ9MÓ!NÔ O؈D�Kð rcóh—tt|j«dz
|jdz
«D]e}|j|}|jj d|«}|dk(rt|j«}|jj
|dz«Œg|j|jdz
S)zHReturns char index in `self.rawdata` for the start of the current line. éú
r )Úrangerr3ÚlinenorÚfindrE)rÚiiÚlast_line_start_posÚlf_poss rÚ line_offsetzHTMLExtractor.line_offset¨s¢€ôœ˜D×3Ñ3Ó4°QÑ6¸¿ ¹ ÀA¹
ÓFò 5ˆBØ"&×"9Ñ"9¸"Ñ"=Ð Ø—\‘\×&Ñ& tÐ-@ÓAˆFؘŠ|ä˜TŸ\™\Ó*�Ø × #Ñ #× *Ñ *¨6°!©8Õ 4ð
 5ð×&Ñ& t§{¡{°1¡}Ñ5Ð5rcóÄ—|jdk(ry|jdkDry|j|j|j|jzj«dk(S)z†
Returns True if current position is at start of line.
Allows for up to three blank spaces at start of line.
rTr FrA)ÚoffsetrrRÚstrip©rs rÚ
at_line_startzHTMLExtractor.at_line_startµsV€ð �;‰;˜!Ò ØØ �;‰;˜Š?Øà�|‰|˜D×,Ñ,¨T×-=Ñ-=ÀÇ Á Ñ-KÐL×RÑRÓTÐXZÑZÐZrcóè—|j|jz}tjj |j
|«}|r|j
||j
«Sdj|«S)z™
Returns the text of the end tag.
If it fails to extract the actual text from the raw data, it builds a closing tag with `tag`.
z</{}>)rRrTrÚ endendtagÚsearchrÚendÚformat)rÚtagrÚms rÚget_endtag_textzHTMLExtractor.get_endtag_textÂs_€ð× Ñ  4§;¡;Ñ.ˆÜ × Ñ × 'Ñ '¨¯ © °eÓ <ˆÙ Ø—<‘<  a§e¡e£gÐ.Ð .ð—>‘> #Ó&Ð &rcó*—||jvr|j||«y|jj|«rJ|js|j «r.|j s"d|_|jjd«|j«}|j r7|jj|«|jj|«y|jj|«||jvr|j«yy)NTrK)r2Úhandle_startendtagr5Úis_block_levelr:rWr9r=rEÚget_starttag_textr;r<ÚCDATA_CONTENT_ELEMENTSÚclear_cdata_mode)rr]ÚattrsÚtexts rÚhandle_starttagzHTMLExtractor.handle_starttagÑsЀà �$—/‘/Ñ !Ø × #Ñ # C¨Ô /Ø à �7‰7× !Ñ ! #Ô &¨D¯KªK¸D×<NÑ<NÔ<PÐY]×YcÒYcàˆDŒJØ �M‰M× Ñ  Ô &à×%Ñ%Ó'ˆØ �:Š:Ø �J‰J× Ñ ˜cÔ "Ø �K‰K× Ñ ˜tÕ $à �M‰M× Ñ  Ô &Ø�d×1Ñ1Ñ1à×%Ñ%Õ'ð2rcó:—|j|«}|j�rb|jj|«||jvr7|jr+|jj «|k(rn
|jrŒ+t
|j«dk(rétj|j|j|jzt
|«zd«r|jjd«nd|_ d|_|jj|jjj!dj#|j«««|jjd«g|_yy|jj|«y)NrrKTFrAú
)r_r9r<rEr;ÚpoprÚ
blank_line_reÚmatchrrRrTr:r=r5rFrGrH)rr]rgs rÚ
handle_endtagzHTMLExtractor.handle_endtagæs,€Ø×#Ñ# CÓ(ˆà �:‹:Ø �K‰K× Ñ ˜tÔ $Ø�d—j‘jÑ à—j’jØ—z‘z—~‘~Ó'¨3Ò.Øð—j“jô�4—:‘:‹ !Ò#ä ×&Ñ& t§|¡|°D×4DÑ4DÀtÇ{Á{Ñ4RÔUXÐY]ÓU^Ñ4^Ð4_Ð'`Ôaà—K‘K×&Ñ& tÕ,ð#'�D”Kà"�”
Ø—
‘
×$Ñ$ T§W¡W×%6Ñ%6×%<Ñ%<¸R¿W¹WÀTÇ[Á[Ó=QÓ%RÔSà—
‘
×$Ñ$ VÔ,Ø �• ð$ð
�M‰M× Ñ  Õ &rcó¸—|jr d|vrd|_|jr|jj|«y|jj|«y)NrKF)r:r9r<rEr=©rÚdatas rrzHTMLExtractor.handle_datasA€Ø �;Š;˜4 4™<؈DŒKØ �:Š:Ø �K‰K× Ñ ˜tÕ $à �M‰M× Ñ  Õ &rcóÖ—|js |jr|jj|«y|j «�r |�rt
j
|j|j|jzt|«zd«r|dz
}nd|_|jr|jdnd}|jd«s,|jd«r|jjd«|jj|jjj|««|jjd«y|jj|«y)z Handle empty tags (`<data>`). NrKTr rArj)r9r:r<rErWrlrmrrRrTrr=Úendswithr5rFrG)rrqÚis_blockÚitems rÚhandle_empty_tagzHTMLExtractor.handle_empty_tag s€à �:Š:˜Ÿšà �K‰K× Ñ ˜tÕ $Ø