Skip to content
Snippets Groups Projects
Commit 5107e733 authored by Douwe Maan's avatar Douwe Maan
Browse files

Fix diff lexer.

parent 9b01ae19
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -12,17 +12,13 @@ module Rouge
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/, 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)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment