ó
JêtIc           @   sj   d  Z  d d l Z d d l Z d e j j f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(	   s.   

Additional support for Pygments formatter.

iÿÿÿÿNt   OdtPygmentsFormatterc           B   s   e  Z d  „  Z d d „ Z RS(   c         C   s)   t  j j j |  ƒ | |  _ | |  _ d  S(   N(   t   pygmentst	   formattert	   Formattert   __init__t   rststyle_functiont   escape_function(   t   selfR   R   (    (    sN   /usr/lib/python2.7/dist-packages/docutils/writers/odf_odt/pygmentsformatter.pyR      s    	c         C   s   |  j  | | ƒ S(   N(   R   (   R   t   namet
   parameters(    (    sN   /usr/lib/python2.7/dist-packages/docutils/writers/odf_odt/pygmentsformatter.pyt   rststyle   s    (    (   t   __name__t
   __module__R   R
   (    (    (    sN   /usr/lib/python2.7/dist-packages/docutils/writers/odf_odt/pygmentsformatter.pyR       s   	t   OdtPygmentsProgFormatterc           B   s   e  Z d  „  Z RS(   c         C   s  t  j j } x| D]\ } } |  j | ƒ } | | j k r_ |  j d ƒ } d | | f } n«| | j j k r“ |  j d ƒ } d | | f } nw| | j j j	 | j j j	 j
 | j j j | j j j | j j j | j j f k r	|  j d ƒ } d | | f } n| | j k r:|  j d ƒ } d | | f } nÐ | | j k rk|  j d ƒ } d | | f } nŸ | | j j k rŸ|  j d ƒ } d | | f } nk | | j j k rÓ|  j d ƒ } d | | f } n7 | | j k r|  j d	 ƒ } d | | f } n | } | j | ƒ q Wd  S(
   Ns   codeblock-keywords.   <text:span text:style-name="%s">%s</text:span>s   codeblock-strings   codeblock-numbers   codeblock-operators   codeblock-comments   codeblock-classnames   codeblock-functionnames   codeblock-name(   R   t   tokent   TokenR   t   KeywordR
   t   Literalt   Stringt   Numbert   Integert   Longt   Floatt   Hext   Octt   Operatort   Commentt   Namet   Classt   Functiont   write(   R   t   tokensourcet   outfilet
   tokenclasst   ttypet   valuet   s2t   s1(    (    sN   /usr/lib/python2.7/dist-packages/docutils/writers/odf_odt/pygmentsformatter.pyt   format   sV    (   R   R   R&   (    (    (    sN   /usr/lib/python2.7/dist-packages/docutils/writers/odf_odt/pygmentsformatter.pyR      s   t   OdtPygmentsLaTeXFormatterc           B   s   e  Z d  „  Z RS(   c         C   sŒ  t  j j } xy| D]q\ } } |  j | ƒ } | | j k r_ |  j d ƒ } d | | f } n| | j j | j j j f k r¢ |  j d ƒ } d | | f } nÕ | | j	 j
 k rÖ |  j d ƒ } d | | f } n¡ | | j k r=| d d k r|  j d ƒ } d | | d  f } qw|  j d ƒ } d | | f } n: | | j	 j k rq|  j d	 ƒ } d | | f } n | } | j | ƒ q Wd  S(
   Ns   codeblock-keywords.   <text:span text:style-name="%s">%s</text:span>s   codeblock-strings   codeblock-operatoriÿÿÿÿs   
s   codeblock-comments/   <text:span text:style-name="%s">%s</text:span>
s   codeblock-name(   R   R   R   R   R   R
   R   R   t   BacktickR   t	   AttributeR   t   BuiltinR   (   R   R   R    R!   R"   R#   R$   R%   (    (    sN   /usr/lib/python2.7/dist-packages/docutils/writers/odf_odt/pygmentsformatter.pyR&   L   s<    (   R   R   R&   (    (    (    sN   /usr/lib/python2.7/dist-packages/docutils/writers/odf_odt/pygmentsformatter.pyR'   K   s   (   t   __doc__R   t   pygments.formatterR   R   R    R   R'   (    (    (    sN   /usr/lib/python2.7/dist-packages/docutils/writers/odf_odt/pygmentsformatter.pyt   <module>	   s
   
1