Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2016-06-15 21:32:27 +0300
committerhttp://jneen.net/ <jneen@jneen.net>2016-07-14 20:08:14 +0300
commit681b5af586eb847651af075b325a8b6ef69f4ec6 (patch)
tree12c4e1dba6a0bb893d225a3b261f213e619dbc34 /lib/gitlab
parent95d6174a0818230a9811d5d302c77760b49597b1 (diff)
do this thing in a clearer way
Diffstat (limited to 'lib/gitlab')
-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