Fix highlighting of deleted lines in diffs.
This commit is contained in:
parent
e0da2c3523
commit
d3730b0713
2 changed files with 25 additions and 0 deletions
|
@ -40,6 +40,7 @@ v 8.0.0 (unreleased)
|
||||||
- Add ability to get user information by ID of an SSH key via the API
|
- Add ability to get user information by ID of an SSH key via the API
|
||||||
- Fix bug which IE cannot show image at markdown when the image is raw file of gitlab
|
- Fix bug which IE cannot show image at markdown when the image is raw file of gitlab
|
||||||
- Add support for Crowd
|
- Add support for Crowd
|
||||||
|
- Fix highlighting of deleted lines in diffs.
|
||||||
|
|
||||||
v 7.14.1
|
v 7.14.1
|
||||||
- Improve abuse reports management from admin area
|
- Improve abuse reports management from admin area
|
||||||
|
|
24
config/initializers/rouge_diff_lexer.rb
Normal file
24
config/initializers/rouge_diff_lexer.rb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# Here until https://github.com/jneen/rouge/pull/297 is merged into Rouge and the gem is updated in GitLab.
|
||||||
|
module Rouge
|
||||||
|
module Lexers
|
||||||
|
class Diff
|
||||||
|
def self.analyze_text(text)
|
||||||
|
return 1 if text.start_with?('Index: ')
|
||||||
|
return 1 if text.start_with?('diff ')
|
||||||
|
return 0.9 if text.start_with?('--- ')
|
||||||
|
end
|
||||||
|
|
||||||
|
state :root do
|
||||||
|
rule(/^ .*\n/, Text)
|
||||||
|
rule(/^---\n/, Text)
|
||||||
|
rule(/^\+.*\n/, Generic::Inserted)
|
||||||
|
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)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue