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
Jérome Perrin
gitlab-ce
Commits
c4ea3947
Commit
c4ea3947
authored
Jul 14, 2016
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use %(...) and %[...] in favor of %<...>
parent
c763c7e4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
6 deletions
+6
-6
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+1
-1
lib/banzai/filter/syntax_highlight_filter.rb
lib/banzai/filter/syntax_highlight_filter.rb
+2
-2
lib/rouge/formatters/html_gitlab.rb
lib/rouge/formatters/html_gitlab.rb
+2
-2
spec/helpers/blob_helper_spec.rb
spec/helpers/blob_helper_spec.rb
+1
-1
No files found.
app/helpers/blob_helper.rb
View file @
c4ea3947
module
BlobHelper
def
highlight
(
blob_name
,
blob_content
,
repository:
nil
,
plain:
false
)
highlighted
=
Gitlab
::
Highlight
.
highlight
(
blob_name
,
blob_content
,
plain:
plain
,
repository:
repository
)
raw
%
<<pre class="code highlight"><code>#{highlighted}</code></pre>>
raw
%
(<pre class="code highlight"><code>#{highlighted}</code></pre>)
end
def
no_highlight_files
...
...
lib/banzai/filter/syntax_highlight_filter.rb
View file @
c4ea3947
...
...
@@ -25,9 +25,9 @@ module Banzai
begin
highlighted
=
''
highlighted
<<
%
<<pre class="#{css_classes}"><code>>
highlighted
<<
%
(<pre class="#{css_classes}"><code>)
highlighted
<<
formatter
.
format
(
lexer
.
lex
(
code
))
highlighted
<<
%
<</code></pre>>
highlighted
<<
%
(</code></pre>)
rescue
# Gracefully handle syntax highlighter bugs/errors to ensure
# users can still access an issue/comment/etc.
...
...
lib/rouge/formatters/html_gitlab.rb
View file @
c4ea3947
...
...
@@ -17,9 +17,9 @@ module Rouge
yield
"
\n
"
unless
is_first
is_first
=
false
yield
%
<<span id="LC#{@line_number}" class="line">>
yield
%
(<span id="LC#{@line_number}" class="line">)
line
.
each
{
|
token
,
value
|
yield
span
(
token
,
value
)
}
yield
%
<</span>>
yield
%
(</span>)
@line_number
+=
1
end
...
...
spec/helpers/blob_helper_spec.rb
View file @
c4ea3947
...
...
@@ -17,7 +17,7 @@ describe BlobHelper do
describe
'#highlight'
do
it
'should return plaintext for unknown lexer context'
do
result
=
helper
.
highlight
(
blob_name
,
no_context_content
)
expect
(
result
).
to
eq
(
%
<<pre class="code highlight"><code><span id="LC1" class="line">:type "assem"))</span></code></pre>>
)
expect
(
result
).
to
eq
(
%
[<pre class="code highlight"><code><span id="LC1" class="line">:type "assem"))</span></code></pre>]
)
end
it
'should highlight single block'
do
...
...
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