Commit a81ce718 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'rouge-patch' into 'master'

Fix highlighting of deleted lines in diffs.

Resolves internal https://dev.gitlab.org/gitlab/gitlabhq/issues/2498

Only needed until https://github.com/jneen/rouge/pull/297 is merged into
Rouge and the gem is updated in GitLab.

Forking `rouge`, releasing `gitlab-rouge` and using that gem wasn't an
option, since `gollum-lib` has `rouge` as a dependency, so it would get
included anyway, and which code we'd get would depend on the load order.

See merge request !1267
parents 3b610d98 d3730b07
...@@ -42,6 +42,7 @@ v 8.0.0 (unreleased) ...@@ -42,6 +42,7 @@ v 8.0.0 (unreleased)
- 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
- Global Labels that are available to all projects - Global Labels that are available to all projects
- 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
......
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment