Skip to content

Commit

Permalink
better detection of erb
Browse files Browse the repository at this point in the history
  • Loading branch information
rubys committed Mar 13, 2016
1 parent c376929 commit 752763d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/gorp/edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ def highlight
# CSS
start = '/* START_HIGHLIGHT */'
close = '/* END_HIGHLIGHT */'
elsif self =~ /;\s*\}?$/
# JavaScript
start = '//#START_HIGHLIGHT'
close = '//#END_HIGHLIGHT'
elsif self =~ /->$/
# CoffeeScript
elsif self =~ /<%=/
# erb
start = '#START_HIGHLIGHT'
close = '#END_HIGHLIGHT'
elsif self =~ /;\s*\}?$/
# JavaScript
start = '// START_HIGHLIGHT'
close = '// END_HIGHLIGHT'
else
# Other, most likely Ruby
start = '#START_HIGHLIGHT'
Expand Down Expand Up @@ -120,7 +120,7 @@ def dup
end

def clear_highlights
self.gsub! /^ *(\/\/#)\s*(START|END)_HIGHLIGHT\n/, ''
self.gsub! /^ *(\/\/#?)\s*(START|END)_HIGHLIGHT\n/, ''
self.gsub! /^ *(#|<!--|\/\*)\s*(START|END)_HIGHLIGHT\s*?(-->|\*\/)?\n/, ''
end

Expand Down

0 comments on commit 752763d

Please sign in to comment.