ó LzñWc@sšddlZddlZddlZddlmZmZddlmZddlm Z ddl Tdd d„ƒYZ d„Z e d kr–e ƒndS( iÿÿÿÿN(tRawLatexParsert RawUtfParser(t VerbParser(t XetexCodec(t*tRawLatexcBsSeZdZd„Zd„Zdd„Zd d„Zd„Zd„Z d„Z RS( sMain latex file parsercCs=tjdƒ|_tƒ|_g|_d|_d|_dS(NsB(\\includegraphics[\[]?|\\begin{overpic}|\\imgexits)[^{]*{([^}]*)}( tretcompiletfigret ImagedatatimagetparserstNonetformattbackend(tself((s:/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/rawtex.pyt__init__s    cCs||j_dS(N(R tpaths(RR((s:/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/rawtex.pyt set_fig_pathsstc Cs d}|jdkr'd}tƒ}n™|sÀt|ƒ}i}d}xc|D][}|sv|jdƒrLd}qLqLn|jdƒr‰Pn|jƒ}|d||dis %%islatex.encodingslatin-1toutput_encodingtcodec( R RRtfilet startswithtsplittgetRRRR R t set_encoding( RtinputRRtftparamststartedtlinetp((s:/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/rawtex.pyt set_parsers s.       cCsJ|dkr!|dkr!d}n||_||_|jj||ƒdS(Ntpdftdvipstps(R RR t set_format(RR R((s:/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/rawtex.pyR'9s    cCs||j_dS(N(R t input_format(RR ((s:/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/rawtex.pyt fig_formatAscCs¯|j|ƒt|ƒ}t|dƒ}xl|D]d}|jrP|j|ƒ}nx*|jD]}|j|ƒ}|sZPqZqZW|r/|j|ƒq/q/W|jƒ|jƒdS(Ntw(R#RR t figconvertR tparsetwritetclose(RRtoutputRtoR!R"((s:/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/rawtex.pyR,Es     cCsy|jj|ƒ}|s|SxV|D]N}|d}|jj|ƒ}||kr#tjd|d||ƒ}q#q#W|S(Nis{%s}(RtfindallR tconvertRtsub(RR!tmlisttmtfigtnewfig((s:/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/rawtex.pyR+Us   $N( t__name__t __module__t__doc__RRR#R R'R)R,R+(((s:/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/rawtex.pyRs     cCsAtƒ}|jtjƒgƒ|jtjdtjdƒdS(Nii(RRtostgetcwdR,tsystargv(tc((s:/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/rawtex.pytmaings t__main__((R=R;RtrawparseRRtrawverbRt xetex.codecRtdbtexmf.core.imagedataRR@R8(((s:/usr/lib/python2.7/dist-packages/dbtexmf/dblatex/rawtex.pyts    V