https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/trac/wiki/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/trac/wiki/__pycache__/macros.cpython-310.pyc
o

�k�`x��@s�ddlmZddlmZddlZddlZddlZddlZddlZddlTddl	m
Z
mZmZm
Z
mZddlmZddlmZmZmZddlmZmZmZmZdd	lmZdd
lmZmZmZddl m!Z!m"Z"m#Z#m$Z$ddl%m&Z&dd
l'm(Z(m)Z)m*Z*ddl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2ddl3m4Z4Gdd�de5�Z6Gdd�de6�Z7Gdd�de6�Z8Gdd�de6�Z9Gdd�de6�Z:Gdd�de6�Z;Gdd�de6�Z<Gdd�de6�Z=Gd d!�d!e6�Z>d$d"d#�Z?dS)%���fnmatchcase)�groupbyN)�*)�Resource�ResourceNotFound�get_resource_name�get_resource_summary�get_resource_url)�as_int)�format_date�from_utimestamp�	user_time)�Markup�escape�find_element�tag)�	separated)�
unicode_quote�
to_unicode�stripws)�_�dgettext�	cleandoc_�tag_)�chrome_resource_path)�IWikiMacroProvider�
WikiSystem�
parse_args)�
MacroError�OutlineFormatter�ProcessorError�extract_link�format_to_html�format_to_oneliner�system_message)�InterWikiMapc@sJeZdZdZee�dZdZdZdZ	dd�Z
dd�Zd	d
�Zd
dd�Z
dS)�
WikiMacroBaseaAbstract base class for wiki macros and processors.

    On usage error, the `MacroError` or `ProcessorError` exception should be
    raised, to ensure proper display of the error message in the rendered
    wiki content.

    The `_description` attribute contains the macro help.

    Set the `hide_from_macro_index` attribute to `True` to prevent
    displaying help in the macro index (`[[MacroList]]`). If the
    default value of `False` and the `_description` is empty,
    "No documentation found" will be displayed.
    TNFccs*�|jj}|�d�r|dd�}|VdS)z4Yield the name of the macro based on the class name.�MacroN���)�	__class__�__name__�endswith)�self�name�r/�2/usr/lib/python3/dist-packages/trac/wiki/macros.py�
get_macrosIs
�

zWikiMacroBase.get_macroscCsB|jrdS|j|j}}|r|r||fS|S|jrt�|j�SdS)z:Return the subclass's gettext domain and macro descriptionN�)�hide_from_macro_index�_domain�_description�__doc__�inspect�cleandoc)r-r.�domain�descriptionr/r/r0�get_macro_descriptionPsz#WikiMacroBase.get_macro_descriptioncCst��N)�NotImplementedError)r-�parserr.�contentr/r/r0�parse_macro\szWikiMacroBase.parse_macrocCstd||jf��)Nz9pre-0.11 Wiki macro %s by provider %s no longer supported)r=r*)r-�	formatterr.r?�argsr/r/r0�expand_macro_s
��zWikiMacroBase.expand_macror<)r+�
__module__�__qualname__r6�
implementsr�abstractr4r5r3r1r;r@rCr/r/r/r0r'.sr'c@s4eZdZdZed�Ze�d�Ze�d�Z	dd�Z
dS)�TitleIndexMacro�messagesa,Insert an alphabetic list of all wiki pages into the output.

    Accepts a prefix string as parameter: if provided, only pages with names
    that start with the prefix are included in the resulting list. If this
    parameter is omitted, all pages are listed. If the prefix is specified,
    a second argument of value `hideprefix` can be given as well, in order
    to remove that prefix from the output.

    The prefix string supports the standard relative-path notation ''when
    using the macro in a wiki page''. A prefix string starting with `./`
    will be relative to the current page, and parent pages can be
    specified using `../`.

    Several named parameters can be specified:
     - `format=compact`: The pages are displayed as comma-separated links.
     - `format=group`: The list of pages will be structured in groups
       according to common prefix. This format also supports a `min=n`
       argument, where `n` is the minimal number of pages for a group.
     - `format=hierarchy`: The list of pages will be structured according
       to the page name path hierarchy. This format also supports a `min=n`
       argument, where higher `n` flatten the display hierarchy
     - `depth=n`: limit the depth of the pages to list. If set to 0,
       only toplevel pages will be shown, if set to 1, only immediate
       children pages will be shown, etc. If not set, or set to -1,
       all pages in the hierarchy will be shown.
     - `include=page1:page*2`: include only pages that match an item in the
       colon-separated list of pages. If the list is empty, or if no `include`
       argument is given, include all pages.
     - `exclude=page1:page*2`: exclude pages that match an item in the colon-
       separated list of pages.

    The `include` and `exclude` lists accept shell-style patterns.
    z(/| )z	([0-9.]+)cst|�\}�|r|d��nd�|ot|�dko|d��dk}t��dd�ddd��t�d��t��dd�ddd����d	d
�}�fdd�}|d
�pMdg�|d���j��j}�rh|rh|jdkrh��	�|j
���ro��d�nd�|rz�fdd��ndd��t�����fdd���
��D��}	|dkr�tt���fdd�|	D�d��S���fdd����fdd��
���fdd����fd d!�����	�fd"d#��	��
fd$d%��
�	��fd&d��
�
�fd'd�d(��|�}
|
r�|
|	�}nt����fd)d�|	D��}tj|d*d+�S),Nr��
hideprefix�min�rL��depth����formatr2csdd���|d��d�D�S)NcSsg|]
}|��r|���qSr/��strip��.0�incr/r/r0�
<listcomp>�s�zDTitleIndexMacro.expand_macro.<locals>.parse_list.<locals>.<listcomp>r2�:)�get�split�r.)�kwr/r0�
parse_list�sz0TitleIndexMacro.expand_macro.<locals>.parse_list�includer�exclude�wiki�/cs|t��d�Sr<��len��page)�prefixr/r0�<lambda>��z.TitleIndexMacro.expand_macro.<locals>.<lambda>cSs|Sr<r/rdr/r/r0rg��c3sj�|]0��dks���d��kr2d��d��vrt�fdd��D��rt�fdd��D��s�VqdS)rra�	WIKI_VIEWr`c3��|]}t�|�VqdSr<rrTrdr/r0�	<genexpr>���z9TitleIndexMacro.expand_macro.<locals>.<genexpr>.<genexpr>c3rkr<r)rU�excrdr/r0rl�rmN)�count�perm�any)rU)rO�excludesrA�includes�startrdr0rl�s�����z/TitleIndexMacro.expand_macro.<locals>.<genexpr>�compactc3s0�|]}tj���|���j�|�d�VqdS���hrefN)r�a�format_page_namerxr`)rU�p�rA�
omitprefixr`r/r0rl�s��
�z, csXg}|D]%}dd��j��j�d�j�|�dd���D�}|�dd�|D�|f�q|S)z�Return a list of (path elements, page_name) pairs,
            where path elements correspond to the page name (without prefix)
            splitted at Camel Case word boundaries, numbers and '/'.
            cS�g|]}|���qSr/rR�rU�eltr/r/r0rW��zKTitleIndexMacro.expand_macro.<locals>.split_pages_group.<locals>.<listcomp>z \1 T)rZcSsg|]}|r|�qSr/r/rr/r/r0rW�r�)�SPLIT_RErZ�NUM_SPLIT_RE�subrz�append)�pages�
page_pathsre�path)r}r-r`r/r0�split_pages_group�s��z7TitleIndexMacro.expand_macro.<locals>.split_pages_groupcs��fdd�|D�S)z�Return a list of (path elements, page_name) pairs,
            where path elements correspond to the page name (without prefix)
            splitted according to the '/' hierarchy.
            cs$g|]}���|���d�|f�qS)ra)rzrZ�rUre�r}r`r/r0rW�s�zOTitleIndexMacro.expand_macro.<locals>.split_pages_hierarchy.<locals>.<listcomp>r/)r�r�r/r0�split_pages_hierarchy�s�z;TitleIndexMacro.expand_macro.<locals>.split_pages_hierarchycs�dd�}g}t||�D]g\}}dd�|D�}|rft|��krf�t|��}t|�dkr<|d\}}|||f}|�|�q�j�|�r\|D]}	t|	t�rU|	\}}|||f}	|�|	�qDq||f}|�|�q|D]	\}
}|�|�qhq|S)a�Transform a flat list of entries into a tree structure.

            `entries` is a list of `(path_elements, page_name)` pairs

            Return a list organized in a tree structure, in which:
              - a leaf is a page name
              - a node is a `(key, nodes)` pairs, where:
                - `key` is the leftmost of the path elements, common to the
                  grouped (path element, page_name) entries
                - `nodes` is a list of nodes or leaves
            cS�|\}}|r
|dSdS�Nrr2r/�rB�eltsr.r/r/r0�keyfn��z?TitleIndexMacro.expand_macro.<locals>.tree_group.<locals>.keyfncS� g|]\}}|dd�|f�qS�rJNr/)rU�
path_elements�	page_namer/r/r0rW���zDTitleIndexMacro.expand_macro.<locals>.tree_group.<locals>.<listcomp>rJr)rrc�sortedr�r��match�
isinstance�tuple)�entriesr��groups�key�grouper�grouped_entries�subnodes�subkey�noder�r�r�)�
minsize_groupr-�
tree_groupr/r0r��s2�
��z0TitleIndexMacro.expand_macro.<locals>.tree_groupcs�dd�}g}t||�D]U\}}dd�|D�}dd�|D�}dd�|D�}|r*|dnd}|r2|d	nd}	|rTt|��krTd
d�|D�}�t|��}
||	|
f}|�|�q|r[|�|�|�|�q|S)a�Transform a flat list of entries into a tree structure.

            `entries` is a list of `(path_elements, page_name)` pairs

            Return a list organized in a tree structure, in which:
              - a leaf is a `(rest, page)` pair, where:
                - `rest` is the rest of the path to be shown
                - `page` is a page name
              - a node is a `(key, nodes, page)` pair, where:
                - `key` is the leftmost of the path elements, common to the
                  grouped (path element, page_name) entries
                - `page` is a page name (if one exists for that node)
                - `nodes` is a list of nodes or leaves
            cSr�r�r/r�r/r/r0r�r�zCTitleIndexMacro.expand_macro.<locals>.tree_hierarchy.<locals>.keyfncSsg|]}|�qSr/r/�rU�er/r/r0rWrhzHTitleIndexMacro.expand_macro.<locals>.tree_hierarchy.<locals>.<listcomp>cSs g|]}t|d�dkr|�qS�rrJrbr�r/r/r0rW� cSs g|]}t|d�dkr|�qSr�rbr�r/r/r0rWr�rNrJcSr�r�r/)rUr�rer/r/r0rWr�)rrcr�r��extend)r�r�r�r�r�r��sub_entries�key_entries�	key_entry�key_pager�r�)�minsize�tree_hierarchyr/r0r��s&�

z4TitleIndexMacro.expand_macro.<locals>.tree_hierarchycst�����fdd�|D��S)Nc	3sb�|],}t�t|t�rtt�|d�d���|d��ntj���|���j�	|�d��VqdS)rrarJrwN)
r�lir�r��strongrSryrzrxr`r�rAr}�render_groupr`r/r0rl%s��$�
��
�zETitleIndexMacro.expand_macro.<locals>.render_group.<locals>.<genexpr>�r�ul��groupr�r/r0r�$s�z2TitleIndexMacro.expand_macro.<locals>.render_groupcst���fdd�|D��S)Nc
3s��|]>}t�t|�dkr,t|dr tj|d�j�|d�d�nt|d��|d��ntjd�|d��j�|d�d��VqdS)�rJrrwrNraN)rr�rcryrxr`�joinr�rA�render_hierarchyr/r0rl-s ��� �

���
�zITitleIndexMacro.expand_macro.<locals>.render_hierarchy.<locals>.<genexpr>r�r�r�r/r0r�,s�z6TitleIndexMacro.expand_macro.<locals>.render_hierarchyc����|���Sr<r/�r{)r�r�r�r/r0rg7rhcr�r<r/r�)r�r�r�r/r0rg8s
�)r��	hierarchyc3s6�|]}t�tj���|���j�|�d��VqdSrv)rr�ryrzrxr`r�r|r/r0rl?s��
�
��
titleindex��class_)rrSrc�_arg_as_intrY�maxr`�resource�realm�resolve_relative_name�idror��	get_pagesrrr��div)r-rAr.r?rBrKrQr]r�r��	transformr�r/)rOrrrArsr\r�r�r}rfr�r�r-r�r�rtr�r�r`r0rC�sX 
$���
	++��
�zTitleIndexMacro.expand_macroN)r+rDrEr4rr5�re�compiler�r�rCr/r/r/r0rHes�
#
rHc@� eZdZdZed�Zdd�ZdS)�RecentChangesMacrorIa�List all pages that have recently been modified, ordered by the
    time they were last modified.

    This macro accepts two ordered arguments and a named argument. The named
    argument can be placed in any position within the argument list.

    The first parameter is a prefix string: if provided, only pages with names
    that start with the prefix are included in the resulting list. If this
    parameter is omitted, all pages are included in the list.

    The second parameter is the maximum number of pages to include in the
    list.

    The `group` parameter determines how the list is presented:
      `group=date` :: The pages are presented in bulleted lists that are
        grouped by date (default).
      `group=none` :: The pages are presented in a single bulleted list.

    Tip: if you only want to specify a maximum number of entries and
    don't want to filter by prefix, specify an empty first parameter,
    e.g. `[[RecentChanges(,10,group=none)]]`.
    cs�t|�\}}|r|d��nd}t|�dkr t|d��dd�nd}|�dd�}d}	g}|rR|jj�}
|	d|
��7}	|�|
�	|��Wd�n1sMwY|	d7}	|ra|	d	7}	|�|�g}d}|j�|	|�D]M\}}
}d
��
d||
�vr{ql�j}t|t
t|��}||kr�|}|�|gf�t|
�}
d}|
dkr��jj|d|
d
�}�j�|�}|dd�|||
|f�ql�fdd�|D�}|dkr�dd�|D�}n
t�dd�|D��}tj|dd�S)NrrJrMr��datezaSELECT name, max(version) AS max_version,
                        max(time) AS max_time FROM wikiz WHERE name %sz% GROUP BY name ORDER BY max_time DESCz	 LIMIT %srjr`�diff)�action�versionrPc3s*�|]\}}|�fdd�|D�fVqdS)c3sX�|]'\}}}}t�tj|�j�|�d�|r$t�dtjtd�|d�d�ndd�VqdS)rwz (r��)N�
)rr�ryrxr`�smallr)rUrer.r��	diff_href�rAr/r0rl�s�
����z<RecentChangesMacro.expand_macro.<locals>.<genexpr>.<genexpr>Nr/�rUr�r�r�r/r0rl�s���
�z2RecentChangesMacro.expand_macro.<locals>.<genexpr>css,�|]\}}tj|dd�t�|�fVqdS)�sectionr�N)r�h3r�r�r/r/r0rl�s� �css�|]\}}|VqdSr<r/r�r/r/r0rl�s��wikipager�)rrSrcr�rY�env�db_query�prefix_matchr��prefix_match_valuerp�reqrrr
�intrxr`rzrr�r�)r-rAr.r?rBr\rf�limitr��sql�db�entries_per_date�prevdater��tsr�r�r�r��items_per_date�outr/r�r0rCasX$
�

��
��zRecentChangesMacro.expand_macroN�r+rDrEr4rr5rCr/r/r/r0r�G��r�c@r�)�PageOutlineMacrorIa	Display a structural outline of the current wiki page, each item in the
    outline being a link to the corresponding heading.

    This macro accepts four optional parameters:

     * The first is a number or range that allows configuring the minimum and
       maximum level of headings that should be included in the outline. For
       example, specifying "1" here will result in only the top-level headings
       being included in the outline. Specifying "2-3" will make the outline
       include all headings of level 2 and 3, as a nested list. The default is
       to include all heading levels.
     * The second parameter can be used to specify a custom title (the default
       is no title).
     * The third parameter selects the style of the outline. This can be
       either `inline` or `pullout` (the latter being the default). The
       `inline` style renders the outline as normal part of the content, while
       `pullout` causes the outline to be rendered in a box that is by default
       floated to the right side of the other content.
     * The fourth parameter specifies whether the outline is numbered or not.
       It can be either `numbered` or `unnumbered` (the former being the
       default). This parameter only has an effect in `inline` style.
    c
sHd\��d}d}d}|rfdd�|�d�D�}t|�dkrf|d}d|vr5��fd	d�|�dd
�D�\��n	t|��d���t|�d
krf|d
��}|dd�D]}	|	����}	|	d
kr_d}qP|	dkred}qPt��}
t|j|j	�}|j
|j|
��|d�t|
�
��}|r�tj|dd�|}|s�tj|dd�}|S|s�tj|dd�}|S)N)rJ�FTcSr~r/rR�rU�argr/r/r0rW�r�z1PageOutlineMacro.expand_macro.<locals>.<listcomp>�,r�-csg|]	}t|��d��qS)�rLr�)r�)rU�d��	max_depth�	min_depthr/r0rW���rJr�rN�inline�
unnumbered��shortenr�r��wiki-toczwiki-toc-un)rZrcr�rS�lower�io�StringIOr r��contextrQ�sourcer�getvaluer�h4r�)
r-rAr.r?�titler��numbered�argvrOr�r��
oformatter�outliner/r�r0rC�sL
������zPageOutlineMacro.expand_macroNr�r/r/r/r0r��r�r�c@sfeZdZdZed�Zdd�ZdZe�	ed�Z
e�	ed�Ze�	d�Ze�	d	�Z
e�	d
�Zdd�Zd
S)�
ImageMacrorIa
Embed an image in wiki-formatted text.

    The first argument is the file specification. The file specification may
    reference attachments in three ways:
     * `module:id:file`, where module can be either '''wiki''' or '''ticket''',
       to refer to the attachment named ''file'' of the specified wiki page or
       ticket.
     * `id:file`: same as above, but id is either a ticket shorthand or a Wiki
       page name.
     * `file` to refer to a local attachment named 'file'. This only works from
       within that wiki page or a ticket.

    The file specification may also refer to:
     * repository files, using the `source:file` syntax
       (`source:file@rev` works also).
     * files, using direct URLs: `/file` for a project-relative,
       `//file` for a server-relative, or `http://server/file` for
       absolute location. An InterWiki prefix may be used.
     * embedded data using the
       [http://tools.ietf.org/html/rfc2397 rfc2397] `data` URL scheme,
       provided the URL is enclosed in quotes.

    The remaining arguments are optional and allow configuring the attributes
    and style of the rendered `<img>` element:
     * digits and unit are interpreted as the size (ex. 120px, 25%)
       for the image
     * `right`, `left`, `center`, `top`, `bottom` and `middle` are interpreted
       as the alignment for the image (alternatively, the first three can be
       specified using `align=...` and the last three using `valign=...`)
     * `link=some TracLinks...` replaces the link to the image source by the
       one specified using a TracLinks. If no value is specified, the link is
       simply removed.
     * `inline` specifies that the content generated be an inline XHTML
       element. By default, inline content is not generated, therefore images
       won't be rendered in section headings and other one-line content.
     * `nolink` means without link to image source (deprecated, use `link=`)
     * `key=value` style are interpreted as HTML attributes or CSS style
       indications for the image. Valid keys are:
        * align, valign, border, width, height, alt, title, longdesc, class,
          margin, margin-(left,right,top,bottom), id and usemap
        * `border`, `margin`, and `margin-`* can only be a single number
          (units are pixels).
        * `margin` is superseded by `center` which uses auto margins

    Examples:
    {{{
    [[Image(photo.jpg)]]               # simplest
    [[Image(photo.jpg, 120px)]]        # with image width size
    [[Image(photo.jpg, right)]]        # aligned by keyword
    [[Image(photo.jpg, nolink)]]       # without link to source
    [[Image(photo.jpg, align=right)]]  # aligned by attribute
    }}}

    You can use an image from a wiki page, ticket or other module.
    {{{
    [[Image(OtherPage:foo.bmp)]]    # from a wiki page
    [[Image(base/sub:bar.bmp)]]     # from hierarchical wiki page
    [[Image(#3:baz.bmp)]]           # from another ticket
    [[Image(ticket:36:boo.jpg)]]    # from another ticket (long form)
    [[Image(source:/img/bee.jpg)]]  # from the repository
    [[Image(htdocs:foo/bar.png)]]   # from project htdocs dir
    [[Image(shared:foo/bar.png)]]   # from shared htdocs dir (since 1.0.2)
    }}}

    ''Adapted from the Image.py macro created by Shun-ichi Goto
    <gotoh@taiyo.co.jp>''
    cCs,dd�|j�|p	d�ddd�D�}d|vS)NcS�g|]}t|��qSr/�rr�r/r/r0rW"r�z(ImageMacro.is_inline.<locals>.<listcomp>r2rJrNr�)�_split_args_rerZ)r-r?rBr/r/r0�	is_inline!s�zImageMacro.is_inlinez((?:[^%s"']|"[^"]*"|'[^']*')+)r�rXz[0-9]+(%|px)?$zp(align|valign|border|width|height|alt|margin(?:-(?:left|right|top|bottom))?|title|longdesc|class|id|usemap)=(.+)z(?:["'])(.*)(?:["'])$c	Cs6d}|rt|�}dd�|j�|�ddd�D�}|sdS|�d�}i}i}d}ddlm}	zdd�|	|j���D�}
WntyFg}
Ynw|�r!|�d�}|j	�
|�rZ||d	<n�|d
krad}n�|�d�r�|�dd�d}t|j|j
|���}
t|
d
�}
d}|
dur�|
j�d
�}n�|dvr�||d<n�|dkr�d|d<|d<d|d<|�dd�nu|dvr�||d<nl|j�
|�}|�r|��\}}|dkr�|dvs�|dkr�|dvr�|�|�nG|dvr�dt||dd�||<n7|d vr�d|vr�dt||dd�||<n#|d!k�rd"t||�|d!<n|j�|�}|�r|�d�}||t|�<|sJ|j�
|��r-|�d#�}d$d�|j�|�ddd�D�}|�rD|dnd}d}}}d}t|j�}|d%v�re|}}|�d&�d}�n!||v�r}|�|d'�|dd���\}}|}�n	|�d(��r�|dd�}}|�d&�d}n�|�d)��r�d}d&|v�r�|�d&d�\}}|�|�}|�r�|d&|7}||}}n�t |�d*k�r�|\}}}d+||f}|�!||�}|�r�|\}}|t"d,�}n�t#||��$d-|�}n�t |�dk�rq|\}}||
v�rd}d.|v�r|�d.d�\}}|jj%||d/�}|jj%||d0d1�}|}ngd}|\}}|�r8|dd2k�r8d3}|dd�}n,|d4k�rM|j�&d5|�}}t'j(�)|�}n|d6k�rb|j�&d6|�}}t'j(�)|�}nd7}|�rpt#||��$d-|�}nt |�dk�r�|j*�$d-|�}nt+t,d8��S|�r�zt-|j|�}Wn t.�y�d}t/|j
j0d9�}t,d:|j1t2|j|j3�d;�}Ynwd<|�4|�v�r�t5|j||j�}t5|j||jd0d=�}d>D]}|�r�||v�r�|||<�q�|�r�d?�d@dA�|�6�D��|dB<t7|j��8||j
j0��s�dC|dD<t9j:dHdE|i|��}|du�rt9j;||�p|dFdG�}|S)INcSrr/rr�r/r/r0rW5r�z+ImageMacro.expand_macro.<locals>.<listcomp>rJrNr2r)�
BrowserModulecSsg|]}|d�qS)rr/)rU�resr/r/r0rWGr��width�nolinkzlink=�=rx)�left�right�float�center�auto�margin-left�margin-right�block�display�margin)�top�bottom�middlezvertical-align�align)rrr�valign)rr r)z
margin-topz
margin-bottomz %dpxrM)rrr�borderz %dpx solid�'"cSsg|]}|�d��qS)r$rR)rU�ir/r/r0rWzs�)�http�https�ftp�data�?rXz//rar��%s:%sz?format=raw�
attachment�@)�rev�raw)r.rQ�#�ticket�htdocs�site�sharedr`zNo filespec givenzcommon/attachment.pngz(No image "%(id)s" attached to %(parent)s)r��parent�ATTACHMENT_VIEW)rQ)r�altz; css$�|]
\}}d|t|�fVqdS)r+N)r)rU�k�vr/r/r0rl�s��z*ImageMacro.expand_macro.<locals>.<genexpr>�style�	anonymous�crossorigin�srczpadding:0; border:none)rxr:r/)<rr
rZ�pop�trac.versioncontrol.web_uirr��get_link_resolvers�	Exception�_size_rer��
startswithr"rrSr�attribrY�_attr_rer�r�r��
_quoted_re�searchr��str�_split_filespec_rer&�rsplit�urlr�rxrc�get_intertrac_urlrr�child�browser�chrome�osr��basenamer�r%rr	rrr�r�rr5rpr
�itemsr�is_safe_originr�imgry)r-rAr.r?rB�filespec�attrr:�linkr�
browser_linksr��valr�r�r��m�partsr�rK�raw_url�descr,�interwikimap�paramsr��filename�intertrac_target�itr.�resultr/r/r0rC/sJ�

��



�



�,
�








�

���
�����
��
�zImageMacro.expand_macroN)r+rDrEr4rr5r�	_split_rer�r�r
rIrBrErFrCr/r/r/r0r
�s�E


r
c@r�)�MacroListMacrorIa�Display a list of all installed Wiki macros, including documentation if
    available.

    Optionally, the name of a specific macro can be provided as an argument. In
    that case, only the documentation for that macro will be rendered.

    Note that this macro will not be able to display the documentation of
    macros if the `PythonOptimize` option is enabled for mod_python!
    csT�r���nd���d������fdd�}tjdd�dd�t|�d	d
�d�D��S)Nr2rc3sB��jjD]��t���p
g�}�rt�fdd�|D��sqz�fdd�|D�}Wn tyH}zttd|dd�|�|fVWYd}~qd}~wwt|dd	�d
�D]L\}}|r�t	|t
tf�rp|drmt|dt|d��nd}nt|�pud}�d
kr�t
�j�j|dd�}nt�j�j|�}n|dur�qQ|dd�|D�fVqQqdS)Nc3s�|]}|���VqdSr<)rC�rUr.)�name_filterr/r0rl�s��zGMacroListMacro.expand_macro.<locals>.get_macro_descr.<locals>.<genexpr>csg|]	}|��|�f�qSr/)r;rf��macro_providerr/r0rW�s��zHMacroListMacro.expand_macro.<locals>.get_macro_descr.<locals>.<listcomp>z/Error: Can't get description for macro %(name)srr[cSs|dS)NrJr/r�r/r/r0rg�szFMacroListMacro.expand_macro.<locals>.get_macro_descr.<locals>.<lambda>�r�rJr2rTr�cSsg|]\}}|�qSr/r/)rUr.�descrr/r/r0rWr�)r`�macro_providers�listr1rqrAr%rrr�r�rrr$r�rr#)�names�name_descriptionsr�rk�pairs�r?rArgr-rhr0�get_macro_descr�s^��

�������
�
��
�
���z4MacroListMacro.expand_macro.<locals>.get_macro_descrztrac-macrolistr�c	ss��|];\}}tjt�d|dd�d|dd�t|�dkr1t�t�td��dd�|dd	�D��p2d	|p:t�td
��fVqd	S)z[[r�]]z%s-macro�r�rJzAliases:cSsg|]	}t�d|d��qS)z [[rs)r�code)rU�aliasr/r/r0rWr�z9MacroListMacro.expand_macro.<locals>.<genexpr>.<listcomp>NzNo documentation found)rr�rurcr{r�r�em)rUr:rnr/r/r0rls�"�
���
�z.MacroListMacro.expand_macro.<locals>.<genexpr>cSs|ddS)NrJrr/)�itemr/r/r0rgsz-MacroListMacro.expand_macro.<locals>.<lambda>rj)rSrr�r�)r-rAr.r?rrr/rqr0rC�s
#��zMacroListMacro.expand_macroNr�r/r/r/r0re�s�rec@r�)�TracIniMacrorIa"Produce documentation for the Trac configuration file.

    Typically, this will be used in the TracIni page. The macro accepts
    two ordered arguments and two named arguments.

    The ordered arguments are a configuration section filter,
    and a configuration option name filter: only the configuration
    options whose section and name start with the filters are output.

    The named arguments can be specified:

     section :: a glob-style filtering on the section names
     option  :: a glob-style filtering on the option names
    cs�ddlm}m}t|�\}}i}dD]-\}}	|�|d���}
|
r(t�|
�||<q|	t|�kr4||	��nd}|r?t	�
|�||<qd|v}dD]}||vrVt	�||t	j�j
ndd�||<qF|d	}
|d}|��j��|��j�}i�|��D]\\}}}|
|�r�||�r�|��|i�|<qw|s��D]}|
|�r���|i�q��D]}tt�|���d
d�d��|<q��fdd
�t��D�}dd�����fdd��tjdd�����fdd�|D��S)Nr)�
ConfigSection�Option))r�r)�optionrJr2r|)r�r|cSsdS)NTr/)r9r/r/r0rg>riz+TracIniMacro.expand_macro.<locals>.<lambda>r�cSs|jSr<r[)r|r/r/r0rgNsrjcs&g|]}||�vr�|jndf�qS)r2)�doc)rUr�)�section_registryr/r0rWOs�
��z-TracIniMacro.expand_macro.<locals>.<listcomp>cSsB|j}|dur|dkrtjt�|�|��dd�Stjtd�dd�S)Nr2�defaultr�z(no default)�	nodefault)rr�tdru�dumpsr)r|rr/r/r0�default_cellSs�z/TracIniMacro.expand_macro.<locals>.default_cellcs6|rtjdd�t�����fdd�t|�D���SdS)Nr`r�c
3sz�|]8\}}tjt�tjt�|j�dd�|jfd��t�t�j�j|j	���|�d�|jf|dr5dndd�VqdS)	ztracini-optionz
#%s-%s-option)r�rxz%s-%s-optionrN�odd�even)r�r�N)
r�trr�ryrur.r#r�rr})rU�idxr|)r�rAr�r-r/r0rl^s$������
�zCTracIniMacro.expand_macro.<locals>.options_table.<locals>.<genexpr>)r�table�tbody�	enumerate)r��options)r�rAr-)r�r0�
options_table[s
���z0TracIniMacro.expand_macro.<locals>.options_table�tracinir�c3sN�|]"\}}tjt�d|�d|d�t�j�j|��|��|��fVqdS)z[%s]z
%s-sectionrtN)rr�rur#r�rrY)rUr��section_doc)rAr�r�r-r/r0rlks���
�z,TracIniMacro.expand_macro.<locals>.<genexpr>)�trac.configrzr{rrYrS�fnmatch�	translatercr�rr��
IGNORECASEr��get_registry�compmgrrR�
setdefaultr��iter�valuesrr�)r-rAr.r?rzr{rBr\�filters�index�patternrf�has_option_filter�section_filter�
option_filter�option_registryr�r�r|�sectionsr/)r�rAr�r�r~r-r0rC-sX������
��zTracIniMacro.expand_macroNr�r/r/r/r0rys�ryc@r�)�KnownMimeTypesMacrorIz�List all known mime-types which can be used as WikiProcessors.

    Can be given an optional argument which is interpreted as mime-type filter.
    cs�ddlm}||j�j}d}t|�\}}|r |�d����d�}i�|��D]\}	}
|r1|
�	|�r>|	|
kr>��
|
g��|	�q&tj
dd�tjdd�t�t�t�td��t�tjd	|jj�d	�d
����t��fdd�t��D����S)
Nr)�Mimeviewr2r�	mimetypesr�r`z
MIME Types�WikiProcessorsrwc
3sF�|]}t�tjt�|�dd�t�t�d�t�|�����VqdS)ztext-align: left)r:� N)rr��thrur�r�r�)rU�	mime_type��
mime_typesr/r0rl�s�����
�z3KnownMimeTypesMacro.expand_macro.<locals>.<genexpr>)�trac.mimeview.apir�r��mime_maprr>rS�rstriprRrCr�r�rr�r��theadr�r�rryrrxr`r�r�)r-rAr.r?r�r��mime_type_filterrBr\r�r�r/r�r0rCzs:��


������z KnownMimeTypesMacro.expand_macroNr�r/r/r/r0r�rs�r�c@s(eZdZdZed�Zgd�Zdd�ZdS)�TracGuideTocMacrorIacDisplay a table of content for the Trac guide.

    This macro shows a quick and dirty way to make a table-of-contents
    for the !Help/Guide. The table of contents will contain the Trac* and
    WikiFormatting pages, and can't be customized. See the
    [https://trac-hacks.org/wiki/TocMacro TocMacro] for a more customizable
    table of contents.
    ))�	TracGuide�Index)�TracInstall�Installation)�TracInterfaceCustomization�
Customization)�TracPlugins�Plugins)�TracUpgrade�	Upgrading)�TracIni�
Configuration)�	TracAdmin�Administration)�
TracBackup�Backup)�TracLogging�Logging)�TracPermissions�Permissions)�TracWikizThe Wiki)�WikiFormattingzWiki Formatting)�TracTimeline�Timeline)�TracBrowserzRepository Browser)�TracRevisionLogzRevision Log)�
TracChangeset�
Changesets)�TracTickets�Tickets)�TracWorkflow�Workflow)�TracRoadmap�Roadmap)�	TracQueryzTicket Queries)�TracBatchModifyzBatch Modify)�TracReports�Reports)�TracRsszRSS Support)�TracNotification�Notificationcsn�jj�d���d�}|dkr�d|d��t|j��tjt�td��t�	����fdd�|j
D��dd	�S)
Nr2rarrJzTable of Contentsc
sRg|]%\}}tjtj|�j��|����|�odd��|�ko$dd��qS)�missing)rxr��activer�)rr�ryrxr`�has_page)rU�refr��curpagerArf�wsr/r0rW�s��
�z2TracGuideTocMacro.expand_macro.<locals>.<listcomp>r�r�)r�r��findrr�rr�rrr��TOC)r-rAr.r?r�r/r�r0rC�s

��zTracGuideTocMacro.expand_macroN)r+rDrEr4rr5r�rCr/r/r/r0r��s�
r�cCsNt|d||d�}|dur%ttd|rt�d||f�d���t�|�d���|S)Nr�zInvalid macro argument %(expr)sz%s=%s)�expr)rrrrru)rYr�rLr��int_valr/r/r0r��s���r�)NNN)@r�r�	itertoolsrr7r�rPr��	trac.core�
trac.resourcerrrr	r
�	trac.utilr�trac.util.datefmtrr
r�trac.util.htmlrrrr�trac.util.presentationr�trac.util.textrrr�trac.util.translationrrrr�trac.web.chromer�
trac.wiki.apirrr�trac.wiki.formatterrr r!r"r#r$r%�trac.wiki.interwikir&�	Componentr'rHr�r�r
reryr�r�r�r/r/r/r0�<module>s@$7cOD>W%:

https://t.me/RX1948 - 2025