diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-01-14 22:28:07 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-01-14 22:28:07 +0100 |
commit | 8dfad143d44af4896ff6c71e8a42ad32b69ad593 (patch) | |
tree | 4f1379b9f00c26a89197629a586b323c820c37a5 /lib/gitlab/highlight.rb | |
parent | 83e4fc188b22731d89106b4da28f11bf5509c116 (diff) | |
download | gitlab-ce-8dfad143d44af4896ff6c71e8a42ad32b69ad593.tar.gz |
Add inline diff markers in highlighted diffs.
Diffstat (limited to 'lib/gitlab/highlight.rb')
-rw-r--r-- | lib/gitlab/highlight.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/highlight.rb b/lib/gitlab/highlight.rb index 02e097eca3d..a5b041687e3 100644 --- a/lib/gitlab/highlight.rb +++ b/lib/gitlab/highlight.rb @@ -7,6 +7,13 @@ module Gitlab formatter.format(lexer.lex(blob_content, continue: continue)).html_safe end + def self.highlight_lines(repository, ref, file_name) + blob = repository.blob_at(ref, file_name) + return [] unless blob + + highlight(file_name, blob.data).lines.map!(&:html_safe) + end + private def self.rouge_formatter(options = {}) |