Remove custom Lexer. #3945 [ci skip]

Inline diff is going to be generated client side now. #3945
This commit is contained in:
Rubén Dávila 2016-01-08 15:17:45 -05:00
parent 21b602c60a
commit 6282202ee8
2 changed files with 1 additions and 28 deletions

View file

@ -95,8 +95,7 @@ module Gitlab
end end
def lexer def lexer
parent = Rouge::Lexer.guess(filename: @file_name, source: @code).new rescue Rouge::Lexers::PlainText.new Rouge::Lexer.guess(filename: @file_name, source: @code).new rescue Rouge::Lexers::PlainText.new
Rouge::Lexers::GitlabDiff.new(parent_lexer: parent)
end end
def unescape_html(content) def unescape_html(content)

View file

@ -1,26 +0,0 @@
Rouge::Token::Tokens.token(:InlineDiff, 'idiff')
module Rouge
module Lexers
# This new Lexer is required in order to avoid the inline diff markup
# to be tokenized, it will be rendered as raw HTML code if that happens.
class GitlabDiff < RegexLexer
title "GitLab Diff"
tag 'gitlab_diff'
state :root do
rule %r{<span class='idiff'>(.*?)</span>} do |match|
token InlineDiff, match[1]
end
rule /(?:(?!<span class='idiff').)*/m do
delegate option(:parent_lexer)
end
end
start do
option(:parent_lexer).reset!
end
end
end
end