summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2016-06-15 11:32:27 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2016-07-14 10:08:14 -0700
commit681b5af586eb847651af075b325a8b6ef69f4ec6 (patch)
tree12c4e1dba6a0bb893d225a3b261f213e619dbc34
parent95d6174a0818230a9811d5d302c77760b49597b1 (diff)
downloadgitlab-ce-681b5af586eb847651af075b325a8b6ef69f4ec6.tar.gz
do this thing in a clearer way
-rw-r--r--lib/gitlab/highlight.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/gitlab/highlight.rb b/lib/gitlab/highlight.rb
index 41296415e35..adac216b337 100644
--- a/lib/gitlab/highlight.rb
+++ b/lib/gitlab/highlight.rb
@@ -28,11 +28,14 @@ module Gitlab
end
def highlight(text, continue: true, plain: false)
+ lexer = @lexer
+
if plain
- @formatter.format(Rouge::Lexers::PlainText.lex(text)).html_safe
- else
- @formatter.format(@lexer.lex(text, continue: continue)).html_safe
+ lexer = Rouge::Lexers::PlainText
+ continue = false
end
+
+ @formatter.format(@lexer.lex(text, continue: continue)).html_safe
rescue
@formatter.format(Rouge::Lexers::PlainText.lex(text)).html_safe
end