HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/hgext/highlight/__pycache__/__init__.cpython-310.pyc
o

�]LbC�@sldZddlmZddlmZddlmZmZddlm	Z	m
Z
dZdd	�Zd
d�Z
dd
�Zdd�Zdd�ZdS)atsyntax 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.
�)�absolute_import�)�	highlight)�webcommands�webutil)�
extensions�pycompatsships-with-hg-corec	Csl|�ddd�}|�ddd�}|�ddd�}|��}|�|��j|�}||���r4tj|||||d�dSdS)	N�web�pygments_style�colorfulshighlightfilesssize('<5M')shighlightonlymatchfilenameF)�guessfilenameonly)	�config�
configbool�	changectx�matchfileset�repo�root�pathr�
pygmentize)	�web�field�fctx�tmpl�style�expr�filenameonly�ctx�m�r�:/usr/lib/python3/dist-packages/hgext/highlight/__init__.pyr1s

��rcCs.|jjd}d|vrt|d||j�|||�S)N�Content-Type�htmlsfileline)�res�headersrr)�origrr�mtrrr�filerevision_highlight>s
r&cCs<|jjd}d|vrt�|j|j�}t|d||j�||�S)Nr r!sannotateline)r"r#r�filectxr�reqrr)r$rr%rrrr�annotate_highlightMs
r)cCsf|�ddd�}tjt�|�d�}d|jjd<|�t�d��}|j�d�	d|t�
|�g��|j��S)	Nr	r
r)rstext/cssr �s/* pygments_style = %s */

)r
r�
HtmlFormatterr�sysstrr"r#�get_style_defs�setbodybytes�join�bytestr�sendresponse)r�pg_style�fmter�
style_defsrrr�generate_cssVs���
r5cCs2t�tdt�t�tdt�tt_tj�d�dS)Ns
_filerevisionsannotateshighlightcss)	r�wrapfunctionrr&r)r5�highlightcss�__all__�append)�uirrr�extsetupfs�r;N)�__doc__�
__future__r�r�mercurial.hgwebrr�	mercurialrr�
testedwithrr&r)r5r;rrrr�<module>s