
    6h<                    b    S r SSKJr  SSKJr  SSKJrJr  SSKJ	r	J
r
  SrS rS	 rS
 rS rS rg)at  syntax highlighting for hgweb (requires Pygments)

It depends on the Pygments syntax highlighting library:
http://pygments.org/

There are the following configuration options::

  [web]
  pygments_style = <style> (default: colorful)
  highlightfiles = <fileset> (default: size('<5M'))
  highlightonlymatchfilename = <bool> (default False)

``highlightonlymatchfilename`` will only highlight files if their type could
be identified by their filename. When this is not enabled (the default),
Pygments will try very hard to identify the file type from content and any
match (even matches with a low confidence score) will be used.
    )annotations   )	highlight)webcommandswebutil)
extensionspycompats   ships-with-hg-corec                N   U R                  SSS5      nU R                  SSS5      nU R                  SSS5      nUR                  5       nUR                  UR	                  5       R
                  U5      nU" UR                  5       5      (       a  [        R                  " XXCUS9  g g )	N   web   pygments_style   colorfuls   highlightfiless   size('<5M')s   highlightonlymatchfilenameF)guessfilenameonly)	config
configbool	changectxmatchfilesetreporootpathr   
pygmentize)	webfieldfctxtmplstyleexprfilenameonlyctxms	            :/usr/lib/python3/dist-packages/hgext/highlight/__init__.pyr   r   1   s    JJv0+>E::f/@D>>&*GOL
..
C))40A~~	
     c                ~    UR                   R                  S   nSU;   a  [        USX!R                  5        U " X5      $ )N   Content-Type   htmls   fileline)resheadersr   r   )origr   r   mts       r    filerevision_highlightr)   >   s7    		)B "}3T884?r!   c                    UR                   R                  S   nSU;   aB  [        R                  " UR                  UR
                  5      n[        USX1R                  5        U " U5      $ )Nr#   r$   s   annotateline)r%   r&   r   filectxr   reqr   r   )r'   r   r(   r   s       r    annotate_highlightr-   M   sM    		)B"}sxx13xx89r!   c                   U R                  SSS5      n[        R                  " [        R                  " U5      S9nSU R
                  R                  S'   UR                  [        R                  " S5      5      nU R
                  R                  SR                  SU-  [        R                  " U5      /5      5        U R
                  R                  5       $ )	Nr   r   r   )r   s   text/cssr#   r!   s   /* pygments_style = %s */

)r   r   HtmlFormatterr	   sysstrr%   r&   get_style_defssetbodybytesjoinbytestrsendresponse)r   pg_stylefmter
style_defss       r    generate_cssr9   V   s    zz&"3[AH##(//(*CDE'2CGGOOO$%%hooc&:;JGG08;  ,	
 77!!r!   c                    [         R                  " [        S[        5        [         R                  " [        S[        5        [
        [        l        [        R                  R                  S5        g )N_filerevisionannotatehighlightcss)	r   wrapfunctionr   r)   r-   r9   r=   __all__append)uis    r    extsetuprB   f   sI    _&< K5GH+K~.r!   N)__doc__
__future__r    r   mercurial.hgwebr   r   	mercurialr   r	   
testedwithr   r)   r-   r9   rB    r!   r    <module>rJ      s<   $ # 
 #


" /r!   