diff --git a/lib/rouge/lexers/erb.rb b/lib/rouge/lexers/erb.rb index b2883b097c..0757b87466 100644 --- a/lib/rouge/lexers/erb.rb +++ b/lib/rouge/lexers/erb.rb @@ -37,7 +37,7 @@ def initialize(opts={}) state :comment do rule close, Comment, :pop! - rule /.+(?=#{close})|.+/m, Comment + rule /.+?(?=#{close})|.+/m, Comment end state :ruby do diff --git a/spec/visual/samples/erb b/spec/visual/samples/erb index f29cde87bd..67ade6e4bb 100644 --- a/spec/visual/samples/erb +++ b/spec/visual/samples/erb @@ -13,6 +13,7 @@ <% end %> +<%# Sometimes you just need to use a variable or two %> <% header_tag = 'h1' %> <<%= header_tag %>>