lib/rouge/lexers/diff.rb in rouge-1.10.0 vs lib/rouge/lexers/diff.rb in rouge-1.10.1

- old
+ new

@@ -10,20 +10,17 @@ mimetypes 'text/x-diff', 'text/x-patch' def self.analyze_text(text) return 1 if text.start_with?('Index: ') return 1 if text.start_with?('diff ') - - # TODO: Have a look at pygments here, seems better - return 0.9 if text =~ /\A---.*?\n\+\+\+/m + return 0.9 if text.start_with?('--- ') end state :root do rule(/^ .*\n/, Text) + rule(/^---\n/, Text) rule(/^\+.*\n/, Generic::Inserted) - # Do not highlight the delimiter line - # before the diffstat in email patches. - rule(/^-+ .*\n/, Generic::Deleted) + rule(/^-+.*\n/, Generic::Deleted) rule(/^!.*\n/, Generic::Strong) rule(/^@.*\n/, Generic::Subheading) rule(/^([Ii]ndex|diff).*\n/, Generic::Heading) rule(/^=.*\n/, Generic::Heading) rule(/.*\n/, Text)