3
V'íc ã @ sh d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z dZ
dZd Zd
Z
G dd deZd
d ZdS )a
pygments.sphinxext
~~~~~~~~~~~~~~~~~~
Sphinx extension to generate automatic documentation of lexers,
formatters and filters.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
é N)Únodes)ÚViewList)Ú Directive)Únested_parse_with_titlesz
.. module:: %s
%s
%s
zX
.. class:: %s
:Short names: %s
:Filenames: %s
:MIME types: %s
%s
zA
.. class:: %s
:Short names: %s
:Filenames: %s
%s
z'
.. class:: %s
:Name: %s
%s
c @ sL e Zd ZdZdZdZdZdZi Zdd Z dd Z
d d
Zdd Zd
d Z
dS )ÚPygmentsDoczn
A directive to collect all lexers/formatters/filters and generate
autoclass directives for them.
Fé r c C sÀ t | _| jd dkr | j }nP| jd dkr8| j }n8| jd dkrP| j }n | jd dkrh| j }ntdtj }t
|jddd }t| j
|| x | jD ]}| j
jjjj| q W |jS )
Nr ÚlexersÚ
formattersÚfiltersZlexers_overviewz,invalid argument for "pygmentsdoc" directiveÚ
Ú )Úsource)ÚsetÚ filenamesÚ argumentsÚdocument_lexersÚdocument_formattersÚdocument_filtersÚdocument_lexers_overviewÚ Exceptionr Zcompoundr Úsplitr ÚstateÚdocumentÚsettingsZrecord_dependenciesÚaddÚchildren)ÚselfÚoutÚnodeZvlÚfn© r ú6/tmp/pip-build-gk9425m9/Pygments/pygments/sphinxext.pyÚrunE s
zPygmentsDoc.runc sj ddl m} ddl}g }g dd }xt|j dd dD ]v\}}|jj|d }|j|j }j ||d |j
d
j|jddjd
dpdd
j|d |d d| d q:W ddddg} fdd| D fdd fdd}
|j |
|j dddd |j |
x:D ]2}|j |d |d |d d!|d d" qW |j |
d#j|S )$z¸Generate a tabular overview of all lexers.
The columns are the lexer name, the extensions handled by this lexer
(or "None"), the aliases and a link to the lexer class.r )ÚLEXERSNc S s |rd| d| dS | S )Nú`z <z>`_r )ÚnameÚurlr r r! Úformat_linkc s z9PygmentsDoc.document_lexers_overview.<locals>.format_linkc S s | d d j S )Nr )Úlower)Úxr r r! Ú<lambda>h s z6PygmentsDoc.document_lexers_overview.<locals>.<lambda>)Úkeyr z, Ú*z\*Ú_ú\ÚNoneé Ú.)r% Ú
extensionsÚaliasesÚclassr% r2 r3 r4 c s"