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

138 lines
14 KiB
Plaintext
Raw Normal View History

Ë
j™&ãóÖdZddlmZddlmZddlmZddlmZm Z ddl
Z
dZ dZ d Z
e
d
zZd jeee ¬ «Zd
jeeee ¬«ZdZe
j&ee
j(«Ze
j&e«Ze
j&e«Ze
j&d«Ze
j&d«ZGdd«ZGdde«ZGdde«ZGdde«ZdZy)
Critic.
pymdownx.critic
Parses critic markup and outputs the file in a more visual HTML.
Must be the last extension loaded.
MIT license.
Copyright (c) 2014 - 2017 Isaac Muse <isaacmuse@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
é)Ú Extension)Ú Preprocessor)Ú
Postprocessor)ÚSTXÚETXNúúz
czjqqkd:%sz[0-9]+z{stx}(?P<key>{key}){etx})ÚkeyÚstxÚetxzY(?x)
(?:
(?P<block>\<p\>(?P<block_keys>(?:{stx}{key}{etx})+)\</p\>) |
{single}
)
)r
Úsingler r aI(?x)
((?P<critic>(?P<open>\{)
(?:
(?P<ins_open>\+{2})
(?P<ins_text>.*?)
(?P<ins_close>\+{2})
| (?P<del_open>\-{2})
(?P<del_text>.*?)
(?P<del_close>\-{2})
| (?P<mark_open>\={2})
(?P<mark_text>.*?)
(?P<mark_close>\={2})
| (?P<comment>
(?P<com_open>\>{2})
(?P<com_text>.*?)
(?P<com_close>\<{2})
)
| (?P<sub_open>\~{2})
(?P<sub_del_text>.*?)
(?P<sub_mid>\~\>)
(?P<sub_ins_text>.*?)
(?P<sub_close>\~{2})
)
(?P<close>\})))
z-((?:ins|del|mark)\s+)(class=([\'"]))(.*?)(\3)z^(?:\r?\n){2,}$có6eZdZdZdZdZd dZdZdZdZ y)
Ú CriticStashzStash critic marks until ready.có.||_i|_d|_y)ú Initialize.rN)Ú stash_keyÚstashÚcount)Úselfrs úR/home/antigravity/intellecton/venv/lib/python3.12/site-packages/pymdownx/critic.pyÚ__init__zCriticStash.__init__Ysð#ˆŒØˆŒ
؈
ócó,t|j«S)zGet length of stash.)Úlenr©rs rÚ__len__zCriticStash.__len__`sä4—::ÐrNcó>|jj||«}|S)z&Get the specified item from the stash.)rÚget)rr
ÚdefaultÚcodes rrzCriticStash.getdsðz‰z~‰~˜c 7Ó+ˆØˆ rcó|j|=y)z)Remove the specified item from the stash.N)r)rr
s rÚremovezCriticStash.removejsð
J‰Js‰Orcó®|jt|j«z}||j|<|xjdz
c_t|zt
zS)z`
Store the code in the stash with the placeholder.
Return placeholder.
é)rÚstrrrÚSOHÚEOT)rr r
s rÚstorezCriticStash.storeosBð n‰nœs 4§:¡:›Ñ؈
3‰Ø
Š
a‰
ÜS‰yœ3‰Ðrcó i|_d|_y)zClear the stash.rN)rrrs rÚclearzCriticStash.clearzsðˆŒ
؈
r)N)
Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrrr"r(r*©rrrrVs#Ùòóò ò
órrcó:eZdZdZˆfdZdZdZdZdZˆxZ S)ÚCriticsPostprocessorz8Handle cleanup on post process for viewing critic marks.có0t|«||_y©rÚsuperrÚ critic_stash©rr6Ú __class__s €rrzCriticsPostprocessor.__init__„óø€ô ÑÔØÕrcófd}|jd«}||jj|«}|S)zaReplace all critic tags in the paragraph block `<p>(critic del close)(critic ins close)</p>` etc.Nr
)Úgroupr6r)rÚcontentr
s rÚ
subrestorezCriticsPostprocessor.subrestoreŠs4àˆØg‰ge‹nˆØ ˆ×'×+¨CÓ0ˆˆrcóüd|jd«jd«vr|jd«S|jd«|jd«z|jd«zdz|jd«zS) zHandle block edits.Úbreakéú rr$éz blocké)r;Úsplit©rr<s rÚ
block_editzCriticsPostprocessor.block_editsgð a—gg˜a“j×&  —77˜1“:Ð à—7‘7˜1“: §¡¨£
Ñ*¨Q¯W©W°Q«ZÑ7¸(ÑBÀQÇWÁWÈQÃZÑ OrcóRd}|jd«Rtj|j|jd««}|Otj|j
|«}n.|j j|jd««}||}||S|jd«S)z-Replace placeholders with actual critic tags.NÚ
block_keysr
r)r;ÚRE_CRITIC_SUB_PLACEHOLDERÚsubr>ÚRE_CRITIC_BLOCKrGr6r)rr<r=Útexts rÚrestorezCriticsPostprocessor.restorešs™ðˆØ 7‰7 Ð  §¡¨Ó!6óˆGðÐ)×-¨d¯o©o¸G‘àׯ©°«Ó8ˆDØÐØØ-ˆwÐ=°1·7±7¸1³:Ð=rcóFtj|j|«}|S)zReplace critic placeholders.)ÚRE_CRITIC_PLACEHOLDERrKrN©rrMs rÚrunzCriticsPostprocessor.runªsô%ׯ©°tÓàˆ r)
r+r,r-r.rr>rGrNrRÚ
__classcell__©r8s@rr1r1s ø„Ù òPòrr1cóTeZdZdZˆfdZdZdZdZdZdZ dZ
d d „Z d
Z ˆxZ
S) ÚCriticViewPreprocessorz0Handle viewing critic marks in Markdown content.có0t|«||_yr3r4r7s €rrzCriticViewPreprocessor.__init__µr9rcóÜtj|«rd|jjd«zS|jjd«|z|jjd«zS)zHandle critic inserts.z
%s
z&<ins class="critic break">&nbsp;</ins>z<ins class="critic">z</ins>©Ú RE_BLOCK_SEPÚmatchr6r(rQs rÚ_inszCriticViewPreprocessor._ins»sjô × Ñ ˜  $×"3Ñ"3×"9Ñ"9Ð:bÓ"cÑ × Ñ × #Ð$:Ó ñ
à × Ñ × # HÓ 

rcóÖtj|«r|jjd«S|jjd«|z|jjd«zS)zHandle critic deletes.z&<del class="critic break">&nbsp;</del>z<del class="critic">z</del>rYrQs rÚ_delzCriticViewPreprocessor._delÆseô × Ñ ˜dÔ ×*Ð+SÓ × Ñ × #Ð$:Ó ñ
à × Ñ × # HÓ 

rcóv|jjd«|z|jjd«zS)zHandle critic marks.z<mark class="critic">z</mark>)r6r(rQs rÚ_markzCriticViewPreprocessor._markÑs?ð
× Ñ × #Ð$;Ó ñ
à × Ñ × # IÓ 

rcóf|jjd|j|d¬«zdz«S)zHandle critic comments.z<span class="critic comment">T)Ústrip_nlz</span>)r6r(Ú html_escaperQs rÚ_commentzCriticViewPreprocessor._commentÚs@ð
× Ñ × × Ñ  °Ð Óñó
ð
rcó0|jd«r |j|jd««S|jd«r |j|jd««S|jd«rA|j|jd««|j|jd««zS|jd«r |j|jd ««S|jd
«r |j |jd ««Sy )
z:Insert appropriate HTML to tags to visualize Critic marks.Úins_openÚins_textÚdel_openÚdel_textÚsub_openÚ sub_del_textÚ sub_ins_textÚ mark_openÚ mark_textÚcom_openÚcom_textN)r;r\r^r`rdrFs rÚ critic_viewz"CriticViewPreprocessor.critic_viewåð
7‰7 Ø—9‘9˜QŸW™W ZÓ
W‰W
Ø—9‘9˜QŸW™W ZÓ
W‰W
à ˜!Ÿ'™'  ˜!Ÿ'™' 
ðW‰W
—:‘:˜aŸg™g 
W‰W
Ø—=‘= §¡¨Ó!4Ó !rcó’|jddk(}|jd«r|r|jd«SdS|jd«r|rdS|jd«S|jd«r|jd «S|jd