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

126 lines
18 KiB
Plaintext
Raw Normal View History

Ë
j²9ãó,dZddlmZddlmZddlmZddlmZddl m
Z
ddl m cm
Z ddlmZddlZd Zd
Zd Zd Zd
ZdZdZej.d«d(d«Zej.d«d(d«Zej.d«d(d«Zd)dZd*dZdZej.d«d+d«Zej.d«d+d«Zej.d«d+d«Z d,dZ! d-dZ"d „Z#Gd!„d"e«Z$Gd#„d$e«Z%Gd%„d&e«Z&d'„Z'y).a°
Arithmatex.
pymdownx.arithmatex
Extension that preserves the following for MathJax use:
```
$Equation$, \(Equation\)
$$
Display Equations
$$
\[
Display Equations
\]
\begin{align}
Display Equations
\end{align}
```
and `$Inline MathJax Equations$`
Inline and display equations are converted to scripts tags. You can optionally generate previews.
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)ÚInlineProcessor)ÚBlockProcessor)Úutil)ÚpartialNézV(?:(?<!\\)((?:\\{2})+)(?=\$)|(?<!\\)(\$)(?!\s)((?:\\.|[^\\$\x02\x03])+?)(?<!\s)(?:\$))zI(?:(?<!\\)((?:\\{2})+)(?=\$)|(?<!\\)(\$)((?:\\.|[^\\$\x02\x03])+?)(?:\$))zR(?:(?<!\\)((?:\\{2})+?)(?=\\\()|(?<!\\)(\\\()((?:\\[^)]|[^\\\x02\x03])+?)(?:\\\)))z8(?P<dollar>[$]{2})(?P<math>((?:\\.|[^\\])+?))(?P=dollar)zH(?P<math2>\\begin\{(?P<env>[a-z]+\*?)\}(?:\\.|[^\\])+?\\end\{(?P=env)\})z&\\\[(?P<math3>(?:\\[^\]]|[^\\])+?)\\\]có–|jdd«}|jdd«}|jdd«}|jdd«}|S) zBasic html escaping.ú&z&amp;ú<z&lt;ú>z&gt;ú"z&quot;)Úreplace)Útxts úV/home/antigravity/intellecton/venv/lib/python3.12/site-packages/pymdownx/arithmatex.pyÚ_escaper?sIð +‰+c˜
#€CØ
+‰+c˜
"€CØ
+‰+c˜
"€CØ
+‰+c˜
$€CØ €JózèThe inline MathJax Preview formatter has been deprecated in favor of the configurable 'arithmatex_fenced_format'. Please see relevant documentation for more information on how to switch before this function is removed in the future.cót|d¬«S)z#Inline math formatter with preview.T©Úpreview©Ú_inline_mathjax_format©ÚmathÚlanguageÚ
class_nameÚmds rÚinline_mathjax_preview_formatrJsô " Ô 5rzàThe inline MathJax formatter has been deprecated in favor of the configurable 'arithmatex_fenced_format'. Please see relevant documentation for more information on how to switch before this function is removed in the future.cót|d¬«S)úInline math formatter.Frrrs rÚinline_mathjax_formatr Usô " Ô 6rzåThe inline generic math formatter has been deprecated in favor of the configurable 'arithmatex_inline_format'. Please see relevant documentation for more information on how to switch before this function is removed in the future.c ó t||||fi|¤ŽS)úInline generic formatter.)Ú_inline_generic_format)rrrrÚkwargss rÚinline_generic_formatr%`sô " °*¸ KÀFÑ Krcótj|ddi«}|r3tj|dddi«}tj|«|_tj|dddi«}tj|«|_|S)rÚclassÚ
arithmatexÚspanÚMathJax_PreviewÚscriptÚtypezmath/tex)ÚetreeÚElementÚ
SubElementÚmd_utilÚ AtomicStringÚtext) rrrrÚtagrÚelÚprer+s rrrksxô
s˜W lÐ3Ó 4€BÙÜ×јr 6¨GÐ5FÐ+GÓHˆÜ×Ó-ˆŒÜ
×
Ñ
˜b (¨V°ZÐ,@Ó
A€FÜ×& ,€F„KØ
€Ircóˆtj|d|i«}tj|j |««|_|S)r"r')r-r.r0r1Úformatr2)rrrrÚwrapr3r4s rr#r#ws9ô
s˜W 1Ó 2€BÜ×" 4§;¡;¨tÓ#4Ó5€B„GØ
€Irc óÈ|jdd«}|jdd«}|jdd«}|dk(rtt|¬«S|dk(rtt|¬ «Sy
) ú>Specify which type of formatter you want and the wrapping tag.ÚmodeÚgenericr3r)rr3ÚmathjaxrN)Úgetrr#r©r$r;r3rs rÚarithmatex_inline_formatrAseð :‰:f˜ (€DØ
*‰*U˜
#€CØj‰j˜ EÓ*€Gà ˆyÒÜÔ-°3Ô
Ò ÜÔ-°wÔ
rzèThe fenced MathJax preview formatter has been deprecated in favor of the configurable 'arithmatex_fenced_format'. Please see relevant documentation for more information on how to switch before this function is removed in the future.c ót|d¬«S)z%Block MathJax formatter with preview.Tr©Ú_fence_mathjax_format©rrrÚoptionsrr$s rÚfence_mathjax_preview_formatrGsô ! ¨tÔ 4rc ót|d¬«S)zBlock MathJax formatter.FrrCrEs rÚfence_mathjax_formatrI˜sô ! ¨uÔ 5rzÞThe generic math formatter has been deprecated in favor of the configurable 'arithmatex_fenced_format'. Please see relevant documentation for more information on how to switch before this function is removed in the future.c ó"t|||||fi|¤ŽS)úGeneric block formatter.)Ú_fence_generic_formatrEs rÚfence_generic_formatrM£sô  x°¸WÀbÑ SÈFÑ Src ó^d|d}|r|dt|«zdzz
}|d|zdzz
}|dz
}|S)zBlock math formatter.r z class="arithmatex">
z<div class="MathJax_Preview">
z
</div>
z'<script type="math/tex; mode=display">
z
</script>
z</div>)r) rrrrFrrr3r$r2s rrDrD®sgð
ˆsˆeÐ *€DÙØ Ø D‹Mñ
à ñ
ñ
ˆð  Ø ñ
àñ ñ€Dð
 ˆ€Dà €Krc
ó4|d}|d} |d}
|jd|«| rd| dnd} djd j|««}|
r)d d jd
|
j«D««znd}
d || ||
d |j|«d
|d
S)rKÚclassesÚid_valueÚattrsrz id="r
Úz class="{}"ú c3ó2K|]\}}|d|dŒy­w)z="r
)Ú.0Úvs rú <genexpr>z(_fence_generic_format.<locals>.<genexpr>Òs èø€ÒB©D¨A¨q˜a˜S  1 # Qœ<ÑBùsr r z</)Úinsertr7ÚjoinÚitems) rrrrFrr8r3r$rPrQrRs rrLrLÅð
€GØ!€HØ 7‰O€Eà ‡NN1!á&.xj Ñ"°B€HØ×" 3§8¡8¨GÓ#4Ó5€GÙFKˆC#—(B°E·K±K³MÔ BÐQS€Eà
ˆsˆeH:˜g˜Y u g¨Q¨t¯{©{¸4Ó/@Ð.AÀÀCÀ5ÈÐ Jrc óÊ|jdd«}|jdd«}|jdd«}|dk(rtt|¬«S|dk(rtt||¬ «Sy
) r:r;r<r3ÚdivrFr=r>©r3rN)r?rrLrDr@s rÚarithmatex_fenced_formatra×sgð :‰:f˜ (€DØ
*‰*U˜
"€CØj‰j˜ *€Gà ˆyÒÜÔ,°#Ô
Ò ÜÔ,°#¸wÔ
rcóveZdZdZdj ej ed«ej«Z dZ
dZ y)ÚInlineArithmatexPatternz"Arithmatex inline pattern handler.z{}{}{}ú\cóˆ|jdd«|_|jdddg«}|djdd«jd d«d
z|d jdd«jd d«z|_|jd d
«|_|jdd«|_t
j||«y)ú Initialize.r<tex_inline_wrapú\(ú\)rú}}ú{}rÚ
inline_tagr)rTN)r?r<rr8rnrrÚ__init__)ÚselfÚpatternÚconfigr8s rroz InlineArithmatexPattern.__init__éð—z‘z )¨UÓŒ Øz‰zÐ+¨e°U¨^Ó<ˆà ‰GO‰O˜C Ó &× .¨s°DÓ 9¸ @À4ÈÁ7Ç?Á?ÐSVÐX\ÓC]×CeÑCeÐfiÐkoÓCpÑ 
Œ ð!Ÿ*™* \°6ÓŒð—z‘z )¨TÓŒ Ü× Ñ   wÕ/rcó,|j«}|d}|st|«dkDr|d}|r=|jd|j«|j d«|j d«fS|d}|st|«dkDr|d}|j rCt||j|j¬«|j d«|j d«fSt||j|j¬«|j d«|j d«fS)zSHandle notations and switch them to something that will be more detectable in HTML.réz\\éé)r8r3r`) ÚgroupsÚlenrÚESCAPED_BSLASHÚstartÚendr<r#r8rnrr)rpÚdatarwÚescapesrs rÚ handleMatchz#InlineArithmatexPattern.handleMatchøðˆØ˜‘)ˆÙœ3˜v›;¨š?ؘQ‘iˆGÙ Ø—?? 6¨4×+>Ñ+>ÓÇÁÈÃÈQÏUÉUÐSTËXÐ a‰yˆÙœ˜F›  ašØ˜!9ˆ <Š<Ü)¨$°T·Y±YÀDÇOÁOÔTÐVW×V]ÑV]Ð^_ÓV`Ðbc×bgÑbgÐhiÓbjÐ )¨$°D·O±OÈTÏ\É\ÔZÐ\]×\cÑ\cÐdeÓ\fÐhi×hmÑhmÐnoÓhpÐ prN) Ú__name__Ú
__module__Ú __qualname__Ú__doc__r7r0ÚSTXÚordÚETXryrorrVrrrcrcäs.Ù—_‘_ W§[¡[±#°d³)¸W¿[¹[ÓI€Nò
qrrccó.eZdZdZdZdZdZdZdZy)ÚBlockArithmatexProcessorz4MathJax block processor to find $$MathJax$$ content.cóÞ|jdd«|_|jdddg«}|djdd«jd d«d
z|d jdd«jd d«z|_|jd d
«|_|jdd«|_d|_tj|«|_ tj||j«y)rfr<tex_block_wrapú\[ú\]rrjrkrlrmrÚ block_tagr_rN)
r?r<rr8rrÚmatchÚreÚcompilerqrroÚparser)rprqrrrr8s rroz!BlockArithmatexProcessor.__init__ð—z‘z )¨UÓŒ Øz‰zÐ*¨U°E¨NÓà ‰GO‰O˜C Ó &× .¨s°DÓ 9¸ @À4ÈÁ7Ç?Á?ÐSVÐX\ÓC]×CeÑCeÐfiÐkoÓCpÑ 
Œ ð Ÿ K°ÓŒð—z‘z )¨UÓŒ àˆŒ
Ü—z‘z 'ÓŒ ä×Ñ  b§i¡iÕ0rcóz|j|jj|«nd|_|jduS)z=Return 'True' for future Python Markdown block compatibility.N)rq)rpÚparentÚblocks rÚtestzBlockArithmatexProcessor.test$s5ð37·,±,Ð2JT—\\×Ô.ÐPTˆŒ
Øz‰z Ð%rcó2|}tj||jddi«}|jr3tj|dddi«}t j
|«|_tj|dddi«}t j
|«|_y) zDefault MathJax output.r'r(r_r*r+r,zmath/tex; mode=displayN)r-r/rrr0r1r2)rpr“rÚ grandparentrr4s rÚmathjax_outputz'BlockArithmatexProcessor.mathjax_output*s…ðˆ Ü×! +¨t¯~©~ÀÈÐ?VÓWˆØ <Š<Ü×& v¨u°wÐ@QÐ6RÓSˆ"×Ó5ˆGŒLÜ