diff options
author | Anteru <bitbucket@ca.sh13.net> | 2019-07-20 09:59:00 +0000 |
---|---|---|
committer | Anteru <bitbucket@ca.sh13.net> | 2019-07-20 09:59:00 +0000 |
commit | abe9fbaf8bfbc386901af8866c04ff455ccf4fa2 (patch) | |
tree | ad8208205e533a6fc898b861e9de679417e60962 /pygments | |
parent | 0822652bed6a1a812add14e1699ca18224e03523 (diff) | |
parent | 2370284149f4490c2206617ef356c8565328b75e (diff) | |
download | pygments-abe9fbaf8bfbc386901af8866c04ff455ccf4fa2.tar.gz |
Merged in bittucket/pygments-main/hbs-update (pull request #773)
HandlebarsLexer Update
Diffstat (limited to 'pygments')
-rw-r--r-- | pygments/lexers/templates.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/pygments/lexers/templates.py b/pygments/lexers/templates.py index 8c423637..498613e0 100644 --- a/pygments/lexers/templates.py +++ b/pygments/lexers/templates.py @@ -1802,27 +1802,26 @@ class HandlebarsLexer(RegexLexer): 'root': [ (r'[^{]+', Other), + # Comment start {{! }} or {{!-- (r'\{\{!.*\}\}', Comment), + # HTML Escaping open {{{expression (r'(\{\{\{)(\s*)', bygroups(Comment.Special, Text), 'tag'), + + # {{blockOpen {{#blockOpen {{/blockClose with optional tilde ~ + (r'(\{\{)([#~/]+)([^\s}]*)', bygroups(Comment.Preproc, Number.Attribute,Number.Attribute), 'tag'), (r'(\{\{)(\s*)', bygroups(Comment.Preproc, Text), 'tag'), ], 'tag': [ (r'\s+', Text), + # HTML Escaping close }}} (r'\}\}\}', Comment.Special, '#pop'), - (r'\}\}', Comment.Preproc, '#pop'), - - # Handlebars - (r'([#/]*)(each|if|unless|else|with|log|in(line)?)', bygroups(Keyword, - Keyword)), - (r'#\*inline', Keyword), - - # General {{#block}} - (r'([#/])([\w-]+)', bygroups(Name.Function, Name.Function)), + # blockClose}}, includes optional tilde ~ + (r'(~?)(\}\})', bygroups(Number, Comment.Preproc), '#pop'), # {{opt=something}} - (r'([\w-]+)(=)', bygroups(Name.Attribute, Operator)), + (r'([^\s}]+)(=)', bygroups(Name.Attribute, Operator)), # Partials {{> ...}} (r'(>)(\s*)(@partial-block)', bygroups(Keyword, Text, Keyword)), @@ -1845,7 +1844,7 @@ class HandlebarsLexer(RegexLexer): include('generic'), ], 'variable': [ - (r'[a-zA-Z][\w-]*', Name.Variable), + (r'[()/@a-zA-Z][\w-]*', Name.Variable), (r'\.[\w-]+', Name.Variable), (r'(this\/|\.\/|(\.\.\/)+)[\w-]+', Name.Variable), ], |