File: //usr/lib/python3/dist-packages/hgext/highlight/__pycache__/__init__.cpython-310.pyc
o
�]LbC � @ sl d Z ddlmZ ddlmZ ddlmZmZ ddlm Z m
Z
dZdd � Zd
d� Z
dd
� Zdd� Zdd� ZdS )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.
� )�absolute_import� )� highlight)�webcommands�webutil)�
extensions�pycompats ships-with-hg-corec C sl | � ddd�}| � ddd�}| �ddd�}|�� }|�|�� j|�}||�� �r4tj|||||d� d S d S ) 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�m� r �:/usr/lib/python3/dist-packages/hgext/highlight/__init__.pyr 1 s
��r c C s. |j jd }d|v rt|d||j� | ||�S )N� Content-Type� htmls fileline)�res�headersr r )�origr r �mtr r r �filerevision_highlight>