;ò 7MDc@sQdkZdkZdkZdkZdklZd„Zdfd„ƒYZdS(N(sECMDSPluginErrorcCst|ƒSdS(sReturns a plugin instance.N(sPluginsconfig(sconfig((s$/opt/ecromedos-1.0.1/plugins/math.pys getInstancessPlugincBsGtZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCsMd|_g|_y|d|_Wn(tj od}t|dƒ‚nXti i |iƒ o#d|if}t|dƒ‚nyd|_ |d|_ Wn(tj od}t|dƒ‚nXti i |i ƒ o#d |i f}t|dƒ‚ny|d |_ Wntj od |_ nXt i dƒ|_dS( Nis latex_bins1Location of the 'latex' executable not specified.smaths%Could not find latex executable '%s'.ss dvipng_bins2Location of the 'dvipng' executable not specified.s(Could not find 'dvipng' executable '%s'.s dvipng_dpiid(sselfscountersnodelistsconfigs latex_binsKeyErrorsmsgsECMDSPluginErrorsosspathsisfiles dvipng_bins dvipng_dpisStringIOsout(sselfsconfigsmsg((s$/opt/ecromedos-1.0.1/plugins/math.pys__init__s0   cCsf|iiƒdjo:|iidƒ|iƒ|iiƒtiƒ|_nd|_g|_dS(s1If format was XHTML, generate GIFs from formulae.is\end{document} iN( sselfsoutstellswrites_Plugin__LaTeX2DVI2GIFsclosesStringIOscountersnodelist(sself((s$/opt/ecromedos-1.0.1/plugins/math.pysflushDs   cCs7|djo|i|ƒ}n|i|ƒ}|SdS(s!Prepare @node for target @format.slatexN(sformatsselfsLaTeX_ProcessMathsnodesresultsXHTML_ProcessMath(sselfsnodesformatsresult((s$/opt/ecromedos-1.0.1/plugins/math.pysprocessUs  cCs{|iƒ}|iidjod|d}ntidƒ}|i|ƒ|i |ƒ|i ƒ|i d7_ |SdS(s.Mark node to be copied 1:1 to output document.sequations$scopyiN( snodes getContentsstringsparentsnameslibxml2snewNodesnewnodes setContents replaceNodesfreeNodesselfscounter(sselfsnodesnewnodesstring((s$/opt/ecromedos-1.0.1/plugins/math.pysLaTeX_ProcessMathbs    c Cs‰ytddƒ}Wn(tj od}t|dƒ‚nXy$|i|iiƒƒ|i ƒWn(tj od}t|dƒ‚nXytddƒ}Wnt j ot i }nXtidƒ}ti|iƒdƒdd df}titi|i|i|Œ}| o%titi|i|i|Œ}nti|dƒ|iƒdjo|i ƒn|d jod }t|dƒ‚nytidƒWntj onXytid ƒWntj onXytid ƒWntj onXytidƒWntj onXd}d|idddddddf }ytddƒ}Wnt j ot i }nXtidƒ}ti|iƒdƒtiti|i|i|Œ}ti|dƒ|iƒdjo|i ƒn|d jod}t|dƒ‚nY|iƒytidƒWntj onXytidƒWntj onXdS(s9Write formulae to LaTeX file, compile and extract images.smath.texswb+s*Could not open temporary file for writing.smaths#Error while writing temporary file.smath_plugin.logis -interactions nonstopmodeis%Could not compile temporary TeX file.smath.auxsmath.logiÿÿÿÿs-Ds--depths-gifs-Tstights-os m%06d.gifsmath.dvis)Could not convert dvi file to GIF images.N(sfilesfpsIOErrorsmsgsECMDSPluginErrorswritesselfsoutsgetvaluescloseslogfps Exceptionssyssstdoutsossdupsdup2sfilenosargssspawnlsP_WAITs latex_binsrvalsremovesOSErrors dvipng_dpis dvipng_bins_Plugin__alignImages(sselfsfpsargssstdoutslogfpsrvalsmsg((s$/opt/ecromedos-1.0.1/plugins/math.pys__LaTeX2DVI2GIFtsˆ!% $!  cCsÏy1ztddƒ}|iƒ}Wd|iƒXWntj o dSnXtidƒ}d}xh|i |ƒD]W}|i ƒi dƒdidƒ}|i|}|id d |d ƒ|d7}qpWdS( s<Add style tag to each bitmap for correct baseline alignment.smath_plugin.logsrbNs\[[0-9]* depth=[0-9]*\]is=is []sstylesvertical-align: -spx;(sfilesfpsreadsstringscloses ExceptionsrescompilesrexprsisfinditersmatchsgroupssplitsstripsalignsselfsnodelistsnodesnewProp(sselfsfpsnodesstringsisrexprsalignsmatch((s$/opt/ecromedos-1.0.1/plugins/math.pys __alignImagesÊs" " cCsš|iiƒdjoÔ|iidƒ|iidƒ|iidƒ|iidƒ|iidƒ|iidƒ|iidƒ|iid ƒ|iid ƒ|iid ƒ|iid ƒ|iid ƒ|iidƒn|iid|iƒfƒtidƒ}tidƒ}|i dd|i fƒ|i ddƒ|i |ƒ|i |ƒ|iƒ|ii|ƒ|i d7_ |SdS(s,Call LaTeX and ImageMagick to produce a GIF.is\documentclass[12pt]{scrartcl} s\usepackage{courier} s\usepackage{helvet} s\usepackage{mathpazo} s\usepackage{amsmath} s2\usepackage[active,displaymath,textmath]{preview} s\frenchspacing{} s\usepackage{ucs} s\usepackage[utf8x]{inputenc} s\usepackage[T1]{autofe} s\PrerenderUnicode{äöüß} s\pagestyle{empty} s\begin{document} s$%s$ \clearpage{} scopysimgssrcs m%06d.gifsaltsiN(sselfsoutstellswritesnodes getContentslibxml2snewNodes copy_nodesimg_nodesnewPropscountersaddChilds replaceNodesfreeNodesnodelistsappend(sselfsnodesimg_nodes copy_node((s$/opt/ecromedos-1.0.1/plugins/math.pysXHTML_ProcessMathås4   ( s__name__s __module__s__init__sflushsprocesssLaTeX_ProcessMaths_Plugin__LaTeX2DVI2GIFs_Plugin__alignImagessXHTML_ProcessMath(((s$/opt/ecromedos-1.0.1/plugins/math.pysPlugins +   V (sosslibxml2sStringIOsreserrorsECMDSPluginErrors getInstancesPlugin(s getInstancesStringIOslibxml2sECMDSPluginErrorsresPluginsos((s$/opt/ecromedos-1.0.1/plugins/math.pys? s$