diff options
author | http://jneen.net/ <jneen@jneen.net> | 2016-06-15 21:32:27 +0300 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2016-07-14 20:08:14 +0300 |
commit | 681b5af586eb847651af075b325a8b6ef69f4ec6 (patch) | |
tree | 12c4e1dba6a0bb893d225a3b261f213e619dbc34 /lib | |
parent | 95d6174a0818230a9811d5d302c77760b49597b1 (diff) |
do this thing in a clearer way
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/highlight.rb | 9 |
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 |