o $•ahã@sRdZddlmZddlmZdedejdefdd„Zd ed ed edefd d „Z dS)z¾ sphinx.util.math ~~~~~~~~~~~~~~~~ Utility functions for math. :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. é)Únodes)ÚHTMLTranslatorÚwriterÚnodeÚreturncCsx|jjjr8|jjjr8d}|jjdkrd|jd|f}n|}|dd}|jj |i¡ |d¡}d t t |ƒ¡S|d S) NÚ displaymathÚ singlehtmlz%s/%séÿÿÿÿÚidsr©Ú.Únumber) ÚbuilderÚconfigÚ math_numfigÚnumfigÚnameÚdocnamesÚ fignumbersÚgetÚjoinÚmapÚstr)rrÚfigtypeÚkeyÚidr r r ú2/usr/lib/python3/dist-packages/sphinx/util/math.pyÚget_node_equation_numbers  rÚtextÚlabelÚ numberingc Csàdtdtfdd„}|durd}nd|}d}tt|| d¡ƒƒ}g}t|ƒd kr*dSt|ƒd krI|r9d |}d }nd |}d}| d|d ¡n|rRd|}d}nd|}d}|D] } | d|  ¡¡qZd|d |¡|fS)NÚpartrcSs| ¡S)N)Ústrip)r!r r rÚ is_equation sz%wrap_displaymath..is_equationÚz \label{%s}Tz réz\begin{equation}z\end{equation}z\begin{equation*}z\end{equation*}z\begin{split}%s\end{split} z \begin{align}%s\!\begin{aligned}z\end{aligned}\end{align}z!\begin{align*}%s\!\begin{aligned}z\end{aligned}\end{align*}z%s\\ z%s %s%s)rÚlistÚfilterÚsplitÚlenÚappendr"r) rrr r#ÚlabeldefÚpartsÚ equationsÚbeginÚendr!r r rÚwrap_displaymaths0  r0N) Ú__doc__ÚdocutilsrÚsphinx.builders.htmlrÚ math_blockrrÚboolr0r r r rÚs