Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERB: Fix greedy comment matching #902

Merged
merged 2 commits into from
Jun 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rouge/lexers/erb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions spec/visual/samples/erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</table>
<% end %>

<%# Sometimes you just need to use a variable or two %>
<% header_tag = 'h1' %>

<<%= header_tag %>>
Expand Down