diff options
author | Robert Speicher <robert@gitlab.com> | 2016-07-15 20:15:30 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-07-15 20:15:30 +0000 |
commit | fbd75c35fd3fd43f6680b925959ac9498e9528a5 (patch) | |
tree | 6af7fc1551b12e735793b7b6aeac507dd431c1d3 /app | |
parent | 27e4a95221539ccb6749b2de8a75a8c17427115f (diff) | |
parent | c4ea394736f98aebd6b370d75a5b3556206ce09d (diff) | |
download | gitlab-ce-fbd75c35fd3fd43f6680b925959ac9498e9528a5.tar.gz |
Merge branch 'feature.rouge-20' into 'master'
Upgrade to Rouge 2.0
## What does this MR do?
This MR is a refactor of the HTMLGitlab formatter. The original was copy-pasted from the legacy HTML formatter and adapted to suit our needs. In particular, this MR:
* Strips dead code and unused options
* Factors out the "wrapping" into the places that care about it - Bonzai and the view helpers
* Uses the Rouge 2.0 `token_lines` method to split tokens into lines, removing the custom code we used to do the same
* Uses the now-public `span` method instead of re-implementing it ourselves
* Removes options to not split into lines - the places where this feature wasn't being used are now using the plain `Formatters::HTML` instead of this class
See merge request !4691
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/blob_helper.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 428a42266d0..abe115d8c68 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -1,10 +1,7 @@ module BlobHelper - def highlighter(blob_name, blob_content, repository: nil, nowrap: false) - Gitlab::Highlight.new(blob_name, blob_content, nowrap: nowrap, repository: repository) - end - - def highlight(blob_name, blob_content, repository: nil, nowrap: false, plain: false) - Gitlab::Highlight.highlight(blob_name, blob_content, nowrap: nowrap, plain: plain, repository: repository) + def highlight(blob_name, blob_content, repository: nil, plain: false) + highlighted = Gitlab::Highlight.highlight(blob_name, blob_content, plain: plain, repository: repository) + raw %(<pre class="code highlight"><code>#{highlighted}</code></pre>) end def no_highlight_files |