Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
6282202e
Commit
6282202e
authored
Jan 08, 2016
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove custom Lexer. #3945 [ci skip]
Inline diff is going to be generated client side now. #3945
parent
21b602c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
28 deletions
+1
-28
lib/gitlab/diff/highlight.rb
lib/gitlab/diff/highlight.rb
+1
-2
lib/rouge/lexers/gitlab_diff.rb
lib/rouge/lexers/gitlab_diff.rb
+0
-26
No files found.
lib/gitlab/diff/highlight.rb
View file @
6282202e
...
@@ -95,8 +95,7 @@ module Gitlab
...
@@ -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
)
...
...
lib/rouge/lexers/gitlab_diff.rb
deleted
100644 → 0
View file @
21b602c6
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment