o
    ih                     @   sl  d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	m
Z
mZmZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZ ddlmZm Z  g d	Z!G d
d de	Z"G dd de	Z#G dd de	Z$G dd de	Z%G dd de	Z&G dd de	Z'G dd de'Z(G dd de
Z)G dd de
Z*G dd de
Z+G dd de	Z,G d d! d!e	Z-dS )"z
    pygments.lexers.markup
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexers for non-HTML markup languages.

    :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)XmlLexer)JavascriptLexer)CssLexer)	
RegexLexerDelegatingLexerincludebygroupsusingthisdo_insertionsdefaultwords)TextCommentOperatorKeywordNameStringNumberPunctuationGenericOther
Whitespace)get_bool_optClassNotFound)BBCodeLexerMoinWikiLexerRstLexerTexLexer
GroffLexerMozPreprocHashLexerMozPreprocPercentLexerMozPreprocXulLexerMozPreprocJavascriptLexerMozPreprocCssLexerMarkdownLexerTiddlyWiki5Lexerc                   @   sh   e Zd ZdZdZdgZdgZdefdedfdefgd	efd
e	e
jeefde	eefdedfgdZdS )r   zR
    A lexer that highlights BBCode(-like) syntax.

    .. versionadded:: 0.6
    BBCodebbcodeztext/x-bbcodez[^[]+z\[/?\w+tagz\[\s+z(\w+)(=)("?[^\s"\]]+"?)z(=)("?[^\s"\]]+"?)z\]#pop)rootr)   N)__name__
__module____qualname____doc__namealiases	mimetypesr   r   r   r   	Attributer   r   tokens r6   r6   Q/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/pygments/lexers/markup.pyr      s&    
r   c                   @   s   e Zd ZdZdZddgZg ZdgZej	ej
B Zdefdeeefdeejeeejefd	eejejd
fdefdeeejefdeeejefdefdeeeefdefdefdefdefgdejdfdedfdejfdejfgdZdS )r   zI
    For MoinMoin (and Trac) Wiki markup.

    .. versionadded:: 0.7
    zMoinMoin/Trac Wiki markupz	trac-wikimoinztext/x-trac-wikiz^#.*$z(!)(\S+)z^(=+)([^=]+)(=+)(\s*#.+)?$z(\{\{\{)(\n#!.+)?	codeblockz(\'\'\'?|\|\||`|__|~~|\^|,,|::)z^( +)([.*-])( )z^( +)([a-z]{1,5}\.)( )z\[\[\w+.*?\]\]z(\[[^\s\]]+)(\s+[^\]]+?)?(\])z^----+$z[^\n\'\[{!_~^,|]+\n.z\}\}\}r+   z\{\{\{z#pushz[^{}]+)r,   r9   N)r-   r.   r/   r0   r1   r2   	filenamesr3   re	MULTILINE
IGNORECASEflagsr   r   r   r   r   Headingr	   r
   r   r   Builtin	NamespacePreprocr5   r6   r6   r6   r7   r   >   s>    


r   c                   @   s~  e Zd ZdZdZdZg dZddgZddgZe	j
Zd	d
 ZdZdZde	ee	ef Zdeejeejeejefdeejeejefdeeeeeddfdeeeeeddfdeeeeeddfdeeeeeddfdeeeeeddfdeeeeeddfdefdeeeejeeeeddfdeeeejeeddfdeeeejeeddfdeeeejeejeeeeddfdejfdeeejefdeeeddeeddfd ee j!ee e ee fe"dgd!efd"e d#fd$ee e j#e fd%e fd&eej$ej%fd'eej%ej$fd(ej&fd)ej'fd*e fd+ejfd,efd-efgd.e fd"e e d/fd0e fgd1Z(d2d3 Z)d4d5 Z*d6S )7r   an  
    For reStructuredText markup.

    .. versionadded:: 0.7

    Additional options accepted:

    `handlecodeblocks`
        Highlight the contents of ``.. sourcecode:: language``,
        ``.. code:: language`` and ``.. code-block:: language``
        directives with a lexer for the given language (default:
        ``True``).

        .. versionadded:: 0.8
    reStructuredTextz(https://docutils.sourceforge.io/rst.html)restructuredtextrstrestz*.rstz*.restz
text/x-rstztext/prs.fallenstein.rstc           
   	   c   s   ddl m} |dt|dfV  |dt|dfV  |dtj|dfV  |dt|dfV  |dt|dfV  |dt|dfV  |d	t|d	fV  d }| j	rvz||d
 }W n	 tyu   Y nw |d
}t|}||d |d |d }|d u r|d
t|fV  d S g }|d}d}|D ]&}	t|	|kr|t|dt|	d | fgf ||	|d  7 }q||	7 }qt|||E d H  d S )Nr   get_lexer_by_name                        	   
      T )pygments.lexersrJ   startr   groupr   r   Wordr   handlecodeblocksstripr   lenr   
splitlinesappendr   get_tokens_unprocessed)
selfmatchrJ   lexer	indentionindention_sizecodeins	codelinesliner6   r6   r7   _handle_sourcecode   s>   
"
"
zRstLexer._handle_sourcecodeu   '")]}>’”»!?u   ‐‑‒–— z((?=$)|(?=[-/:.,; \n\x00%s%s]))zH^(=+|-+|`+|:+|\.+|\'+|"+|~+|\^+|_+|\*+|\++|#+)([ \t]*\n)(.+)(\n)(\1)(\n)zc^(\S.*)(\n)(={3,}|-{3,}|`{3,}|:{3,}|\.{3,}|\'{3,}|"{3,}|~{3,}|\^{3,}|_{3,}|\*{3,}|\+{3,}|#{3,})(\n)z!^(\s*)([-*+])( .+\n(?:\1  .+\n)*)inlinestatez1^(\s*)([0-9#ivxlcmIVXLCM]+\.)( .+\n(?:\1  .+\n)*)z4^(\s*)(\(?[0-9#ivxlcmIVXLCM]+\))( .+\n(?:\1  .+\n)*)z$^(\s*)([A-Z]+\.)( .+\n(?:\1  .+\n)+)z*^(\s*)(\(?[A-Za-z]+\))( .+\n(?:\1  .+\n)+)z^(\s*)(\|)( .+\n(?:\|  .+\n)*)zl^( *\.\.)(\s*)((?:source)?code(?:-block)?)(::)([ \t]*)([^\n]+)(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\8.*)?\n)+)z,^( *\.\.)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))z'^( *\.\.)(\s*)(_(?:[^:\\]|\\.)+:)(.*?)$z^( *\.\.)(\s*)(\[.+\])(.*?)$z9^( *\.\.)(\s*)(\|.+\|)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))z^ *\.\..*(\n( +.*\n|\n)+)?z+^( *)(:(?:\\\\|\\:|[^:\n])+:(?=\s))([ \t]*)z!^(\S.*(?<!::)\n)((?:(?: +.*)\n)+)z2(::)(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\3.*)?\n)+)\\.z``literalz(`.+?)(<.+?>)(`__?)z`.+?`__?z(`.+?`)(:[a-zA-Z0-9:-]+?:)?z(:[a-zA-Z0-9:-]+?:)(`.+?`)z\*\*.+?\*\*z\*.+?\*z\[.*?\]_z<.+?>z[^\\\n\[*`:]+r;   z[^`]+r+   `)r,   rk   ro   c                 K   $   t |dd| _tj| fi | d S Nr[   Tr   r[   r   __init__ra   optionsr6   r6   r7   rt        zRstLexer.__init__c                 C   s   | d d dkr| dd dkrdS |  d}|  d|d }|dkrA|d d |krC| |d  d	v rE| |d  | |d  krGd
S d S d S d S d S )NrL   z..rM   r;   g333333?
rK   z-=g      ?)find)textp1p2r6   r6   r7   analyse_text  s    
zRstLexer.analyse_textN)+r-   r.   r/   r0   r1   urlr2   r<   r3   r=   r>   r@   rj   closersunicode_delimitersescapeend_string_suffixr   r   rA   r   r   r	   r
   r   r   rZ   r   Tagr   rD   Classr   Escaper   InterpolVariabler4   StrongEmphr5   rt   r~   r6   r6   r6   r7   r   k   s    )
:Rr   c                
   @   s  e Zd ZdZdZddgZg dZddgZdefd	e	j
fd
e	j
fgdejdfdedfdejdfdedfdedfdefeddefgde	jfeddefdefde	j
fgdedfdedfedgdedfdedfde	j
fedgde	jfdefedgdZd d! Zd"S )#r   z<
    Lexer for the TeX and LaTeX typesetting languages.
    TeXtexlatex)z*.texz*.auxz*.tocz
text/x-texztext/x-latexz%.*?\nz[{}]z[&_^]z\\\[displaymathz\\\(
inlinemathz\$\$z\$z\\([a-zA-Z]+|.)commandz\\$generalz[^\\$%&_^{}]+[0-9]+z[-=!+*/()\[\]]z[^=!+*/()\[\]\\$%&_^{}0-9-]+z\\\)r+   mathz\\\]z\[.*?\]z\*)r   r,   r   r   r   r   c                 C   s(   dD ]}| d t | |kr dS qd S )N)z\documentclassz\inputz\documentstylez\relaxT)r]   )r{   rX   r6   r6   r7   r~   F  s
   zTexLexer.analyse_textN)r-   r.   r/   r0   r1   r2   r<   r3   r   r   rB   r   Backtickr   r   r   r   r   r   r4   r   r5   r~   r6   r6   r6   r7   r     sP    

)r   c                
   @   s   e Zd ZdZdZg dZg dZddgZdee	e
dfd	edfd
e	dfedgedd
e	fde	dfgdefdejfdejfdejfdejfde	dfgde	dfeddejfdefdefde	fgdZdd ZdS )r   z
    Lexer for the (g)roff typesetting language, supporting groff
    extensions. Mainly useful for highlighting manpage sources.

    .. versionadded:: 0.6
    Groff)groffnroffman)z*.[1-9]z*.manz*.1pz*.3pmzapplication/x-troffz
text/troffz	(\.)(\w+)requestz\.z[^\\\n]+textlineescapesr:   r+   z	\\"[^\n]*z\\[fn]\wz\\\(.{2}z	\\.\[.*\]rn   z\\\nz	"[^\n"]+"z\d+z\S+r*   )r,   r   r   r   c                 C   sd   | d d dkr
dS | d d dkrdS | d d dkrdS | dd   r.| d  r0d	S d S d S )
NrK   r;   FrM   z.\"TrN   z.TH g?)isalnumisspace)r{   r6   r6   r7   r~   z  s   zGroffLexer.analyse_textN)r-   r.   r/   r0   r1   r2   r<   r3   r   r   r   r   r   r   r   r   r   Doubler   r5   r~   r6   r6   r6   r7   r   M  s>    
 r   c                   @   s   e Zd ZdZdZegZg Zg Zdej	dfde
fgdeej	edfedej	d	fged
efdeeefdefdejfdejfdejfdefded	fdefdefg
dZdS )r    z
    Lexer for Mozilla Preprocessor files (with '#' as the marker).

    Other data is left untouched.

    .. versionadded:: 2.0
    mozhashpreprocz^#expr	exprstart.+z(literal)(.*)z#pop:2)defineundefififdefifndefelseelifelifdefelifndefendifexpandfilterunfilterr   includesubsterrorr+   )!z!=z==z&&z||z(defined)(\()z\)r   z__\w+?__z@\w+?@z\w+r:   r*   z\S)r,   r   r   N)r-   r.   r/   r0   r1   r2   r<   r3   r   rD   r   r   r   r   r   r   r   r   Decimalr   r   r   r5   r6   r6   r6   r7   r      s4    

	
r    c                   @   s:   e Zd ZdZdZegZg Zg Zddej	dfde
fgiZdS )r!   z
    Lexer for Mozilla Preprocessor files (with '%' as the marker).

    Other data is left untouched.

    .. versionadded:: 2.0
    mozpercentpreprocr,   z^%r   r   N)r-   r.   r/   r0   r1   r2   r<   r3   r   rD   r   r5   r6   r6   r6   r7   r!     s    
r!   c                       4   e Zd ZdZdZdgZdgZg Z fddZ  Z	S )r"   z
    Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
    `XmlLexer`.

    .. versionadded:: 2.0
    zXUL+mozpreproczxul+mozpreprocz*.xul.inc                       t  jttfi | d S N)superrt   r   r    ru   	__class__r6   r7   rt        zMozPreprocXulLexer.__init__
r-   r.   r/   r0   r1   r2   r<   r3   rt   __classcell__r6   r6   r   r7   r"         r"   c                       r   )r#   z
    Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
    `JavascriptLexer`.

    .. versionadded:: 2.0
    zJavascript+mozpreproczjavascript+mozpreprocz*.js.inc                    r   r   )r   rt   r   r    ru   r   r6   r7   rt     r   z"MozPreprocJavascriptLexer.__init__r   r6   r6   r   r7   r#     r   r#   c                       r   )r$   z
    Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
    `CssLexer`.

    .. versionadded:: 2.0
    zCSS+mozpreproczcss+mozpreprocz*.css.inc                    r   r   )r   rt   r   r!   ru   r   r6   r7   rt     r   zMozPreprocCssLexer.__init__r   r6   r6   r   r7   r$     r   r$   c                   @   s  e Zd ZdZdZdZddgZddgZdgZe	j
Zd	d
 Zdeejefdeejefdeejeejefdeejeejefdeeeeeeddfdeeeeeeddfdeeeeeddfdeeejfdejfdefedgdefdeeejfdeeejfdeeejfdeeejfdeeejfdeeejfdejfdeeejeeejefd eeejeeej efd!eeej eejfd"efd#efgd$Z!d%d& Z"d'S )(r%   z9
    For Markdown markup.

    .. versionadded:: 2.2
    Markdownz-https://daringfireball.net/projects/markdown/markdownmdz*.mdz
*.markdownztext/x-markdownc                 c   s    ddl m} |dtj|dfV  |dtj|dfV  |dt|dfV  d}| jrGz||d }W n	 t	yF   Y nw |d}|du rZ|dt|fV  nt
g ||E dH  |dtj|dfV  dS 	zV
        match args: 1:backticks, 2:lang_name, 3:newline, 4:code, 5:backticks
        r   rI   rK   rL   rM   NrN   rO   )rW   rJ   rX   r   r   rY   r   r[   r\   r   r   r`   ra   rb   rJ   rc   rf   r6   r6   r7   _handle_codeblock   s"   
zMarkdownLexer._handle_codeblockz(^#[^#].+)(\n)z(^#{2,6}[^#].+)(\n)z^(.+)(\n)(=+)(\n)z^(.+)(\n)(-+)(\n)z^(\s*)([*-] )(\[[ xX]\])( .+\n)rk   rl   z^(\s*)([*-])(\s)(.+\n)z^(\s*)([0-9]+\.)( .+\n)z^(\s*>\s)(.+\n)z^(\s*```\n[\w\W]*?^\s*```$\n)z(^(\s*```)(\w+)(\n)([\w\W]*?)(^\s*```$\n)rn   z([^`]?)(`[^`\n]+`)z ([^\*]?)(\*\*[^* \n][^*\n]*\*\*)z([^_]?)(__[^_ \n][^_\n]*__)z([^\*]?)(\*[^* \n][^*\n]*\*)z([^_]?)(_[^_ \n][^_\n]*_)z([^~]?)(~~[^~ \n][^~\n]*~~)z[@#][\w/:]+z (!?\[)([^]]+)(\])(\()([^)]+)(\))z(\[)([^]]+)(\])(\[)([^]]*)(\])z^(\s*\[)([^]]*)(\]:\s*)(.+)z[^\\\s]+r;   )r,   rk   c                 K   rq   rr   rs   ru   r6   r6   r7   rt   \  rw   zMarkdownLexer.__init__N)#r-   r.   r/   r0   r1   r   r2   r<   r3   r=   r>   r@   r   r   r   rA   r   
Subheadingr   r   r	   r
   r   r   r   r   r   Deletedr   Entityr   r4   Labelr5   rt   r6   r6   r6   r7   r%     sb    @r%   c                   @   s  e Zd ZdZdZdZdgZdgZdgZe	j
Zdd Zd	d
 Zdeeeejfdeejefdeejefdeeeeeeddfdeeeefdeejfdeejfdeejfdeejfdeeeefdefdefededgeddddefgdefdejfd eeejefd!eeejfd"eeejfd#eeejfd$eeejefd%eeejefd&ejfd'ejfd(ejfd)ejfd*ejfd+ej fd,ej!fd-eeejefd.eeejeej"efd/eeejefd0eej"fd1efd2efgd3Z#d4d5 Z$d6S )7r&   z<
    For TiddlyWiki5 markup.

    .. versionadded:: 2.7
    tiddlerz$https://tiddlywiki.com/#TiddlerFilestidz*.tidztext/vnd.tiddlywikic                 c   s    ddl m} |dt|dfV  |dt|dfV  |dt|dfV  d}| jrEz||d }W n	 tyD   Y nw |d}|du rY|dt|fV  dS t	g |
|E dH  |dt|dfV  dS r   )rW   rJ   rX   r   rY   r   r[   r\   r   r   r`   r   r6   r6   r7   r   n  s$   
z"TiddlyWiki5Lexer._handle_codeblockc                 c   s    ddl m} |dt|dfV  |dt|dfV  d}| jr4z|d}W n	 ty3   Y nw |d}|du rH|dt|fV  dS tg ||E dH  |dt|dfV  dS )	zP
        match args: 1:style tag 2:newline, 3:code, 4:closing style tag
        r   rI   rK   rL   NcssrM   rN   )	rW   rJ   rX   r   rY   r[   r   r   r`   r   r6   r6   r7   _handle_cssblock  s"   
z!TiddlyWiki5Lexer._handle_cssblockz^(title)(:\s)(.+\n)z^(!)([^!].+\n)z^(!{2,6})(.+\n)z^(\s*)([*#>]+)(\s*)(.+\n)rk   rl   z^(<<<.*\n)([\w\W]*?)(^<<<.*$)z^(\|.*?\|h)$z^(\|.*?\|[cf])$z^(\|.*?\|k)$z^(;.*)$z^(```\n)([\w\W]*?)(^```$)z ^(```)(\w+)(\n)([\w\W]*?)(^```$)z$^(<style>)(\n)([\w\W]*?)(^</style>$)keywords)z\definez\endcaptioncreatedmodifiedtagstitletype^z\b)prefixsuffixrn   z\d{17}z(\s)(//[^/]+//)((?=\W|\n))z(\s)(\^\^[^\^]+\^\^)z(\s)(,,[^,]+,,)z(\s)(__[^_]+__)z(\s)(''[^']+'')((?=\W|\n))z(\s)(~~[^~]+~~)((?=\W|\n))z	<<[^>]+>>z\$\$[^$]+\$\$z\$\([^)]+\)\$z^@@.*$z	</?[^>]+>z`[^`]+`z&\S*?;z(\[{2})([^]\|]+)(\]{2})z$(\[{2})([^]\|]+)(\|)([^]\|]+)(\]{2})z(\{{2})([^}]+)(\}{2})z(\b.?.?tps?://[^\s"]+)z[\w]+r;   )r,   r   rk   c                 K   rq   rr   rs   ru   r6   r6   r7   rt     rw   zTiddlyWiki5Lexer.__init__N)%r-   r.   r/   r0   r1   r   r2   r<   r3   r=   r>   r@   r   r   r   r   r   r   rA   r   r	   r
   r   r   r   r   r   r   r   r   Integerr   r   Regexr4   r5   rt   r6   r6   r6   r7   r&   a  s    Ur&   ).r0   r=   pygments.lexers.htmlr   pygments.lexers.javascriptr   pygments.lexers.cssr   pygments.lexerr   r   r   r   r	   r
   r   r   r   pygments.tokenr   r   r   r   r   r   r   r   r   r   r   pygments.utilr   r   __all__r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r6   r6   r6   r7   <module>   s,    
,4!- ):8)n