File: //usr/lib/python3/dist-packages/trac/web/__pycache__/chrome.cpython-310.pyc
o
�k�`� � @ s� d Z ddlmZ ddlZddlZddlZddlZddlZddl Z ddl
Z
ddlmZ ddl
mZ ddlmZmZ ddlT ddlT ddlmZmZ dd lmZ ddlT dd
lmZmZmZmZmZm Z m!Z!m"Z"m#Z# ddl$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ ddl,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6 dd
l7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJ ddlKmLZLmMZM ddlNmOZOmPZP ddlQmRZR ddlSmTZT ddlUmVZVmWZWmXZX dZYdZZG dd� de[�Z\G dd� de[�Z]dd� Z^d@dd�Z_dAdd�Z`dBd d!�ZadCd#d$�Zbi fd%d&�Zcd'd(� Zdd)d*� Zed+d,� ZfdDd-d.�ZgdEd/d0�Zh 1 1dFd2d3�Zid4d5� ZjdEd6d7�Zkd8d9� Zld:d;� Zmed<d=� �ZnG d>d?� d?eo�ZpdS )Gz�Content presentation for the web layer.
The Chrome module deals with delivering and shaping content to the end
user, mostly targeting (X)HTML generation but not exclusively, RSS or
other forms of web content are also using facilities provided here.
� )�contextmanagerN)�partial)�FileSystemLoader)�IEnvironmentSetupParticipant�ISystemInfoProvider)�*)�RenderingContext�get_mimetype)�IPermissionRequestor) �as_bool�as_int�get_pkginfo�get_reporter_id�html�pathjoin�presentation�to_list�translation)�Element�Markup�escape� plaintext�tag�to_fragment�valid_html_bytes)
�exception_to_unicode�
is_obfuscated�javascript_quote� jinja2env�obfuscate_email_address�pretty_size�shorten_line�to_js_string�
to_unicode�unicode_quote_plus)�pretty_timedelta�datetime_now�format_datetime�format_date�format_time�from_utimestamp� http_date�utc�get_date_format_jquery_ui�is_24_hours�get_time_format_jquery_ui� user_time�get_month_names_jquery_ui�get_day_names_jquery_ui�get_timezone_list_jquery_ui�get_first_week_day_jquery_ui�"get_timepicker_separator_jquery_ui�get_period_names_jquery_ui�localtz)�_�get_available_locales)�IRequestHandler�HTTPNotFound)�Href)�IWikiSyntaxProvider)� format_to�format_to_html�format_to_oneliner)�wiki�timeline�roadmap�browser�tickets� newticket�search�admin)�login�logout�prefs�help�aboutc @ � e Zd ZdZdd� Zdd� ZdS )�INavigationContributorzZExtension point interface for components that contribute items to the
navigation.
c C � dS )z�This method is only called for the `IRequestHandler` processing
the request.
It should return the name of the navigation item to be highlighted
as active/current.
N� ��reqrQ rQ �1/usr/lib/python3/dist-packages/trac/web/chrome.py�get_active_navigation_itemJ � z1INavigationContributor.get_active_navigation_itemc C rP )a� Should return an iterable object over the list of navigation items
to add, each being a tuple in the form (category, name, text).
The category determines the location of the navigation item and
can be `mainnav` or `metanav`. The name is a unique identifier that
must match the string returned by get_active_navigation_item.
The text is typically a link element with text that corresponds
to the desired label for the navigation item, and an href.
NrQ rR rQ rQ rT �get_navigation_itemsR rV z+INavigationContributor.get_navigation_itemsN)�__name__�
__module__�__qualname__�__doc__rU rW rQ rQ rQ rT rO E s rO c @ rN )�ITemplateProviderz�Extension point interface for components that provide their own
Jinja2 templates and/or accompanying static resources.
c C rP )a� Return a list of directories with static resources (such as style
sheets, images, etc.)
Each item in the list must be a `(prefix, abspath)` tuple. The
`prefix` part defines the path in the URL that requests to these
resources are prefixed with.
The `abspath` is the absolute path to the directory containing the
resources on the local file system.
NrQ rQ rQ rQ rT �get_htdocs_dirsd rV z!ITemplateProvider.get_htdocs_dirsc C rP )zUReturn a list of directories containing the provided template
files.
NrQ rQ rQ rQ rT �get_templates_dirsp rV z$ITemplateProvider.get_templates_dirsN)rX rY rZ r[ r] r^ rQ rQ rQ rT r\ ^ s r\ c C s | j �d�r|S dS )zXHelper function for creating accesskey HTML attribute according
to preference values�
accesskeysN)�sessionr )rS �keyrQ rQ rT � accesskeyv s rb c C s* ||||||d�}| j �dg ��|� dS )z;Add a `<meta>` tag into the `<head>` of the generated HTML.)�contentz
http-equiv�name�scheme�langzxml:lang�metasN)�chrome�
setdefault�append)rS rc �
http_equivrd re rf �metarQ rQ rT �add_meta| s �rm c K sn d||f }| j �dt� �}||v rdS ||||d�} | �|� | j �di �}
|
�|g ��| � |�|� dS )zrAdd a link to the chrome info that will be inserted as <link> element in
the <head> of the generated HTML
z%s:%s�linksetN)�href�title�type�class�links)rh ri �set�updaterj �add)rS �relro rp �mimetype� classname�attrs�linkidrn �linkrs rQ rQ rT �add_link� s
r} �text/cssc K s&