3
V'íc÷ ã @ @ sÐ d Z ddlZddlmZmZ ddlmZmZ ddlm Z ddl
mZ ddlm
Z
ddlmZ dd lmZmZ dd
lmZ ddlmZ ddlmZmZmZmZmZmZmZmZm Z dd
l!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- ddl.m/Z/m0Z0 dddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNg@Z1G dOd deZ2G dPd deZ3G dQd= d=eZ4G dRd> d>eZ5G dSd? d?eZ6G dTd deZ7G dUd' d'eZ8G dVd( d(eZ9G dWd) d)eZ:G dXd+ d+eZ;G dYd* d*eZ<G dZd, d,eZ=G d[d- d-eZ>G d\d. d.eZ?G d]d/ d/eZ@G d^d0 d0eZAG d_d1 d1eZBG d`da daeZCG dbd3 d3eZDG dcd4 d4eZEG ddd5 d5eZFG ded6 d6eZGG dfd$ d$eZHG dgdh dheZIG did# d#eZJG djd" d"eZKG dkd& d&eZLG dld% d%eZMG dmd deZNG dnd deZOG dod deZPG dpd deZQG dqd deZRG drd deZSG dsd deZTG dtd deZUG dud deZVG dvd deZWG dwd deZXG dxd deZYG dyd deZZG dzd d eZ[G d{d deZ\G d|d! d!eZ]G d}d~ d~eZ^G dd2 d2eZ_G dd7 d7eZ`G dd8 d8eZaG dd9 d9eZbG dd: d:eZcG dd
d
eZdG dd; d;eZeG dd< d<eZfG dd@ d@eZgG dd deZhG ddA dAeZiG ddB dBeZjG ddC dCeZkG ddD dDeZlG ddE dEeZmG ddF dFeZnG ddG dGeZoG ddH dHeZpG ddI dIeZqG ddJ dJeZrG ddK dKeZsG ddL dLeZtG ddM dMeZuG ddN dNeZvdS )zã
pygments.lexers.templates
~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for various template engines' markup.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
é N)Ú HtmlLexerÚXmlLexer)ÚJavascriptLexerÚ
LassoLexer)ÚCssLexer)ÚPhpLexer)ÚPythonLexer)Ú PerlLexer)Ú JavaLexerÚTeaLangLexer)Ú YamlLexer)ÚSqlLexer) ÚLexerÚDelegatingLexerÚ
RegexLexerÚbygroupsÚincludeÚusingÚthisÚdefaultÚcombined)ÚErrorÚPunctuationÚ
WhitespaceÚTextÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚOtherÚToken)Úhtml_doctype_matchesÚlooks_like_xmlÚHtmlPhpLexerÚXmlPhpLexerÚCssPhpLexerÚJavascriptPhpLexerÚErbLexerÚ
RhtmlLexerÚXmlErbLexerÚCssErbLexerÚJavascriptErbLexerÚSmartyLexerÚHtmlSmartyLexerÚXmlSmartyLexerÚCssSmartyLexerÚJavascriptSmartyLexerÚDjangoLexerÚHtmlDjangoLexerÚCssDjangoLexerÚXmlDjangoLexerÚJavascriptDjangoLexerÚGenshiLexerÚHtmlGenshiLexerÚGenshiTextLexerÚCssGenshiLexerÚJavascriptGenshiLexerÚMyghtyLexerÚMyghtyHtmlLexerÚMyghtyXmlLexerÚMyghtyCssLexerÚMyghtyJavascriptLexerÚ
MasonLexerÚ MakoLexerÚ
MakoHtmlLexerÚMakoXmlLexerÚMakoJavascriptLexerÚMakoCssLexerÚJspLexerÚCheetahLexerÚCheetahHtmlLexerÚCheetahXmlLexerÚCheetahJavascriptLexerÚEvoqueLexerÚEvoqueHtmlLexerÚEvoqueXmlLexerÚColdfusionLexerÚColdfusionHtmlLexerÚColdfusionCFCLexerÚ
VelocityLexerÚVelocityHtmlLexerÚVelocityXmlLexerÚSspLexerÚTeaTemplateLexerÚLassoHtmlLexerÚ
LassoXmlLexerÚ
LassoCssLexerÚLassoJavascriptLexerÚHandlebarsLexerÚHandlebarsHtmlLexerÚYamlJinjaLexerÚLiquidLexerÚ TwigLexerÚ
TwigHtmlLexerÚ
Angular2LexerÚAngular2HtmlLexerÚ
SqlJinjaLexerc @ sJ e Zd ZdZdZdZdgZdgZej dej
Zdd Zd d
Z
dd Zd
S )r) zÙ
Generic ERB (Ruby Templating) lexer.
Just highlights ruby code between the preprocessor directives, other data
is left untouched by the lexer.
All options are also forwarded to the `RubyLexer`.
ZERBzhttps://github.com/ruby/erbZerbzapplication/x-ruby-templatingz*(<%%|%%>|<%=|<%#|<%-|<%|-%>|%>|^%[^%].*?$)c K s* ddl m} |f || _tj| f| d S )Nr )Ú RubyLexer)Zpygments.lexers.rubyre Ú
ruby_lexerr Ú__init__)ÚselfÚoptionsre © rj ú=/tmp/pip-build-gk9425m9/Pygments/pygments/lexers/templates.pyrg D s zErbLexer.__init__c c s0 | j j|}|j d }}yöxî|dkrR|j }|t|fV |t|7 }d}q$|dkrÈ|j }|dkr|t|fV |d7 }d}q|dkrÎ|tj|fV |j }|d t|fV |dt| 7 }d}q|dkr>|tj|fV |t|7 }|j }d}x,| jj |D ]\}} }
|| | |
fV qW |t|7 }d}n|dkrf|t
|fV |t|7 }d}n`|tj|d fV d}x8| jj |dd
D ] \}} }
|d | | |
fV qW |t|7 }d}q$|dkr$|j }|dkrð|t|fV n|tj|fV |t|7 }d}q$W W n tk
r* d
S X d
S )z¡
Since ERB doesn't allow "<%" and other tags inside of ruby
blocks we have to use a split approach here that fails for
that too.
r é ú<%%ú%%>é z<%#é ú<%ú<%=ú<%-ú%>ú-%>N)rm rn )rq rr rs )rt ru )rt ru )Ú _block_reÚsplitÚreverseÚpopr! Úlenr ÚPreprocrf Úget_tokens_unprocessedr Ú
IndexError)rh ÚtextÚtokensÚstateÚidxÚvalÚtagÚdataZr_idxZr_tokenZr_valuerj rj rk r| I sh
zErbLexer.get_tokens_unprocessedc C s d| krd| krdS d S )Nz<%z%>gÙ?rj )r~ rj rj rk Úanalyse_text s zErbLexer.analyse_textN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚurlÚaliasesÚ mimetypesÚreÚcompileÚMrv rg r| r
rj rj rj rk r) 3 s Dc