403Webshell
Server IP : 3.147.158.171  /  Your IP : 216.73.216.229
Web Server : Apache/2.4.67 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-2-178.us-east-2.compute.internal 6.1.172-216.329.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 20 06:31:34 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.21
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /tsai/repo/api/app/utilities/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /tsai/repo/api/app/utilities/__pycache__/math_tex.cpython-310.pyc
o

�Kjn�
@s�dZddlmZddlZe�d�Ze�d�Zidd�dd	�d
d�dd
�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�d#d$�id%d&�d'd$�d(d&�d)d*�d+d*�d,d-�d.d/�d0d1�d2d3�d4d5�d6d7�d8d9�d:d;�d<d=�d>d?�d@dA�dBdC��idDdE�dFdG�dHdI�dJdK�dLdM�dNdO�dPdQ�dRdS�dTdU�dVdW�dXdY�dZd[�d\d]�d^d_�d`da�dbdc�ddde��idfdg�dhdi�djdk�dldm�dndo�dpdq�drds�dtdu�dvdw�dxdy�dzdy�d{d|�d}d~�dd��d�d��d�d��d�d���id�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d��d�d���d�d�d�d�d�d�d�d�d�d�d�d���Ze�d�d��e	ee
d�d���d��Ze�d�ej�Z
e�d��Ze�d��Ze�d��Ze�d��Ze�d��Ze�d��Ze�d��Zd�d�dƄZd�d�dɄZdS)�u(Inline LaTeX-math normalization for article HTML.

AI-generated article bodies occasionally wrap short formulas in TeX math
delimiters, e.g. ``$$\nabla_\text{rad} > \nabla_\text{ad}$$``. The shared
``MarkdownIt`` parser (commonmark) has no math plugin and the WordPress themes
load no MathJax/KaTeX, so the raw TeX survives rendering and leaks onto the
published page as literal ``$$...$$`` text.

`convert_math` runs on the *final* HTML (after markdown rendering, like
`normalize_citations`) and rewrites the small subset of TeX these articles use
into plain Unicode + ``<sub>``/``<sup>`` markup that renders everywhere with no
front-end dependency:

    $$\nabla_\text{rad} > \nabla_\text{ad}$$
        -> <span class="tsai-math">∇<sub>rad</sub> &gt; ∇<sub>ad</sub></span>

It is a best-effort transform: constructs it does not recognize degrade to
cleaned-up text (delimiters and backslashes stripped) rather than raw TeX. It
is idempotent — once the ``$``-delimiters are gone there is nothing left to
match — so it is safe to re-run on its own output.
�)�annotationsNz@\\(?:text|mathrm|mathbf|mathit|mathsf|mathcal|operatorname)\s*\{z'\\(?:,|;|:|!|quad|qquad|thinspace|;|\s)�times�×Zcdot�·�div�÷�pm�±�mpu∓Zlequ≤�leZgequ≥�geZnequ≠�neZapproxu≈�equivu≡�simu∼Zsimequ≃Zproptou∝Zllu≪Zggu≫zll zgg Z
rightarrowu→�toZ	leftarrowu←Zleftrightarrowu↔Z
Rightarrowu⇒Z	Leftarrowu⇐Zmapstou↦Zinftyu∞�partialu∂�nablau∇�sqrtu√�sumu∑�produ∏�intu∫Zointu∮Zodotu⊙�oplusu⊕�otimesu⊗�staru⋆�astu∗�primeu′�circu∘�deg�°Zangleu∠�inu∈�notinu∉Zsubsetu⊂Zsupsetu⊃�cupu∪�capu∩�forallu∀�existsu∃Zlangleu⟨Zrangleu⟩Zldotsu…Zcdotsu⋯�alphauα�betauβ�gammauγ�deltauδ�epsilonuεZ
varepsilon�zetauζ�etauη�thetauθZvarthetauϑ�iotauι�kappauκ�lambdauλ�mu�µ�nuuν�xiuξ�piuπZvarpiuϖ�rhouρZvarrhouϱ�sigmauσZvarsigmauς�tauuτ�upsilonuυ�phiuφZvarphiuϕ�chiuχ�psiuψ�omegauωuΓuΔuΘuΛuΞuΠuΣuΥuΦuΨuΩ)�Gamma�Delta�Theta�Lambda�Xi�Pi�Sigma�Upsilon�Phi�Psi�Omegaz\\(�|T)�key�reversez
)(?![A-Za-z])z
\$\$(.+?)\$\$z\$(?!\$)([^$\n]+?)\$z
_\{([^{}]*)\}z\^\{([^{}]*)\}z_([^\s_^{}<&])z\^([^\s_^{}<&])z$\\frac\s*\{([^{}]*)\}\s*\{([^{}]*)\}z
\\([A-Za-z]+)�tex�str�returncCs�|}t�d|�}t�d|�}t�d|�}t�dd�|�}t�d|�}t�d|�}t�d|�}t�d|�}t	�d|�}|�
dd	��
d
d	�}t�dd|���}|S)zBTranslate a single TeX math fragment (delimiters already removed).� z\1/\2�{cSst|�d�S)N�)�_SYMBOLS�group��m�rU�(/tsai/repo/api/app/utilities/math_tex.py�<lambda>\sz_convert_tex.<locals>.<lambda>z
<sub>\1</sub>z
<sup>\1</sup>z\1��}z	[ \t]{2,})
�_SPACING�sub�_FRAC�
_FONT_CMDS�
_SYMBOL_RE�
_SUB_BRACE�
_SUP_BRACE�	_SUB_CHAR�	_SUP_CHAR�
_LEFTOVER_CMD�replace�re�strip)rK�srUrUrV�_convert_texVsrh�htmlcCs@|rd|vr|Sddd�}ddd	�}t�||�}t�||�}|S)a�Rewrite TeX math spans in ``html`` to Unicode + ``<sub>``/``<sup>`` markup.

    Handles display ``$$...$$`` and inline ``$...$`` delimiters. Inline spans are
    only converted when they actually look like math (contain a backslash, brace,
    or sub/superscript) so ordinary prose with currency amounts is left alone.
    Idempotent and safe to run on HTML that contains no math.
    �$rT�'re.Match[str]'rMrLcSsdt|�d���d�S)N�<span class="tsai-math">rP�</span>)rhrRrSrUrUrV�
_display_replrsz#convert_math.<locals>._display_replcSs0|�d�}t�d|�s|�d�Sdt|��d�S)NrPz[\\{}_^]rrlrm)rRre�searchrh)rT�bodyrUrUrV�_inline_replus

z"convert_math.<locals>._inline_replN)rTrkrMrL)�_DISPLAYr[�_INLINE)rirnrqrUrUrV�convert_mathgs

rt)rKrLrMrL)rirLrMrL)�__doc__�
__future__rre�compiler]rZrQ�join�sorted�lenr^�Srrrsr_r`rarbr\rcrhrtrUrUrUrV�<module>s�

�������������������������������	�	�	�	�
�
�
�
�
���������
�
�
�
����������������������������������

��









Youez - 2016 - github.com/yon3zu
LinuXploit