lib/rouge/lexers/jinja.rb in rouge-3.3.0 vs lib/rouge/lexers/jinja.rb in rouge-3.4.0

- old
+ new

@@ -80,11 +80,11 @@ # Numbers rule /\d+(?=}\s)/, Num # Arithmetic operators (+, -, *, **, //, /) # TODO : implement modulo (%) - rule /(\+|\-|\*|\/\/?|\*\*?)/, Operator + rule /(\+|\-|\*|\/\/?|\*\*?|=)/, Operator # Comparisons operators (<=, <, >=, >, ==, ===, !=) rule /(<=?|>=?|===?|!=)/, Operator # Punctuation (the comma, [], ()) @@ -110,10 +110,15 @@ rule /%}|}}/, Comment::Preproc, :pop! end state :statement do + rule /(raw|verbatim)(\s+)(\%\})/ do + groups Keyword, Text, Comment::Preproc + goto :raw + end + rule /(\w+\.?)/ do |m| if self.class.keywords.include?(m[0]) groups Keyword elsif self.class.pseudo_keywords.include?(m[0]) groups Keyword::Pseudo @@ -130,9 +135,18 @@ mixin :function mixin :literal mixin :text rule /\%\}/, Comment::Preproc, :pop! + end + + state :raw do + rule %r{(\{\%)(\s+)(endverbatim|endraw)(\s+)(\%\})} do + groups Comment::Preproc, Text, Keyword, Text, Comment::Preproc + pop! + end + + rule /(.+?)/m, Text end end end end