Ñò Žf¯Jc@s^dZddklZddklZlZdgZd„ZhZdefd„ƒYZ dS(sÌ pygments.formatters.svg ~~~~~~~~~~~~~~~~~~~~~~~ Formatter for SVG output. :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. iÿÿÿÿ(t Formatter(t get_bool_optt get_int_optt SvgFormattercCs@|iddƒiddƒiddƒiddƒid d ƒS( s<Escape &, <, > as well as single and double quotes for HTML.t&s&ts>t"s"t's'(treplace(ttext((s;/usr/lib/python2.6/site-packages/pygments/formatters/svg.pyt escape_htmls    cBsAeZdZdZdgZdgZd„Zd„Zd„ZRS(sl Format tokens as an SVG graphics file. This formatter is still experimental. Each line of code is a ```` element with explicit ``x`` and ``y`` coordinates containing ```` elements with the individual token styles. By default, this formatter outputs a full SVG document including doctype declaration and the ```` root element. *New in Pygments 0.9.* Additional options accepted: `nowrap` Don't wrap the SVG ```` elements in ```` elements and don't add a XML declaration and a doctype. If true, the `fontfamily` and `fontsize` options are ignored. Defaults to ``False``. `fontfamily` The value to give the wrapping ```` element's ``font-family`` attribute, defaults to ``"monospace"``. `fontsize` The value to give the wrapping ```` element's ``font-size`` attribute, defaults to ``"14px"``. `xoffset` Starting offset in X direction, defaults to ``0``. `yoffset` Starting offset in Y direction, defaults to the font size if it is given in pixels, or ``20`` else. (This is necessary since text coordinates refer to the text baseline, not the top edge.) `ystep` Offset to add to the Y coordinate for each subsequent line. This should roughly be the text size plus 5. It defaults to that value if the text size is given in pixels, or ``25`` else. `spacehack` Convert spaces in the source to `` ``, which are non-breaking spaces. SVG provides the ``xml:space`` attribute to control how whitespace inside tags is handled, in theory, the ``preserve`` value could be used to keep all whitespace as-is. However, many current SVG viewers don't obey that rule, so this option is provided as a workaround and defaults to ``True``. t���SVGt���svgs���*.svgc������ ���K���s��t��i�|��|��t�|�d�t�ƒ�|��_�|�i�d�d�ƒ�|��_�|�i�d�d�ƒ�|��_�t�|�d�d�ƒ�|��_ �|��i�i �ƒ��}�|�i �d�ƒ�o�|�d � i �ƒ��}�n�y�t �|�ƒ�}�Wn �d �}�n�Xt�|�d �|�ƒ�|��_ �t�|�d �|�d �ƒ�|��_�t�|�d�t�ƒ�|��_�h��|��_�d��S(���Nt���nowrapt ���fontfamilyt ���monospacet���fontsizet���14pxt���xoffseti����t���pxiþÿÿÿi���t���yoffsett���ystepi���t ���spacehack(���R����t���__init__R���t���FalseR���t���getR���R���R���R���t���stript���endswitht���intR���R���t���TrueR���t ���_stylecache(���t���selft���optionst���fst���int_fs(����(����s;���/usr/lib/python2.6/site-packages/pygments/formatters/svg.pyR���P���s ����� c��� ������C���sÇ��|��i��}�|��i�}�|��i�pj�|��i�o�|�i�d�|��i�ƒ�n�|�i�d�ƒ�|�i�d�ƒ�|�i�d�ƒ�|�i�d�|��i�|��i�f�ƒ�n�|�i�d�|�|�f�ƒ�xû�|�D]ó�\�}�}�|��i�|�ƒ�}�|�o�d�|�d�p�d �}�|�o�d �p�d �} �t�|�ƒ�}�|��i �o�|�i �ƒ��i �d �d �ƒ�}�n�|�i �d �ƒ�} �xK�| �d� D]?�} �|�i�|�| �| �ƒ�|�|��i �7}�|�i�d�|�|�f�ƒ�q;W|�i�|�| �d�| �ƒ�q¤�W|�i�d�ƒ�|��i�p�|�i�d�ƒ�n�d�S(���sÏ��� Format ``tokensource``, an iterable of ``(tokentype, tokenstring)`` tuples and write it into ``outfile``. For our implementation we put all lines in their own 'line group'. s$��� s��� sk��� s)��� s$��� s)���s���t��� s��� s��� iÿÿÿÿs1��� s���s ��� N(���R���R���R���t���encodingt���writeR���R���t ���_get_styleR ���R���t ���expandtabsR ���t���splitR���( ���R ���t ���tokensourcet���outfilet���xt���yt���ttypet���valuet���stylet���tspant���tspanendt���partst���part(����(����s;���/usr/lib/python2.6/site-packages/pygments/formatters/svg.pyt���format_unencodedb���s>����         �    �    c���������C���sÂ���|�|��i��j�o �|��i��|�S|�}�x!�|��i�i�|�ƒ�p �|�i�}�q%�W|��i�i�|�ƒ�}�d�}�|�d�o�d�|�d�d�}�n�|�d�o�|�d�7}�n�|�d�o�|�d�7}�n�|�|��i��|�<|�S( ���NR$���t���colors��� fill="#R���t���bolds��� font-weight="bold"t���italics��� font-style="italic"(���R���R1���t ���styles_tokent���parentt���style_for_token(���R ���t ���tokentypet ���otokentypeR0���t���result(����(����s;���/usr/lib/python2.6/site-packages/pygments/formatters/svg.pyR(���‹���s ���� �    ( ���t���__name__t ���__module__t���__doc__t���namet���aliasest ���filenamesR���R6���R(���(����(����(����s;���/usr/lib/python2.6/site-packages/pygments/formatters/svg.pyR������s���.    )N( ���RB���t���pygments.formatterR����t ���pygments.utilR���R���t���__all__R ���t ���class2styleR���(����(����(����s;���/usr/lib/python2.6/site-packages/pygments/formatters/svg.pyt��� ���s ���