lib/rouge/lexers/handlebars.rb in rouge-3.6.0 vs lib/rouge/lexers/handlebars.rb in rouge-3.7.0

- old
+ new

@@ -25,12 +25,20 @@ token Keyword push :stache push :open_sym end - rule(/(.+?)(?=\\|{{)/m) { delegate parent } + rule(/(.+?)(?=\\|{{)/m) do + delegate parent + # if parent state is attr, then we have an html attribute without quotes + # pop the parent state to return to the tag state + if parent.state?('attr') + parent.pop! + end + end + # if we get here, there's no more mustache tags, so we eat # the rest of the doc rule(/.+/m) { delegate parent } end @@ -41,13 +49,16 @@ rule(/[{}]/) { token Comment } end state :stache do rule %r/}}}?/, Keyword, :pop! + rule %r/\|/, Punctuation + rule %r/~/, Keyword rule %r/\s+/m, Text rule %r/[=]/, Operator rule %r/[\[\]]/, Punctuation + rule %r/[\(\)]/, Punctuation rule %r/[.](?=[}\s])/, Name::Variable rule %r/[.][.]/, Name::Variable rule %r([/.]), Punctuation rule %r/"(\\.|.)*?"/, Str::Double rule %r/'(\\.|.)*?'/, Str::Single @@ -63,11 +74,11 @@ rule %r([#/]) do token Keyword goto :block_name end - rule %r/[>^&]/, Keyword + rule %r/[>^&~]/, Keyword rule(//) { pop! } end state :block_name do @@ -75,6 +86,6 @@ rule id, Name::Namespace, :pop! rule(//) { pop! } end end end -end +end \ No newline at end of file