Commit c4ea3947 authored by http://jneen.net/'s avatar http://jneen.net/

use %(...) and %[...] in favor of %<...>

parent c763c7e4
module BlobHelper module BlobHelper
def highlight(blob_name, blob_content, repository: nil, plain: false) def highlight(blob_name, blob_content, repository: nil, plain: false)
highlighted = Gitlab::Highlight.highlight(blob_name, blob_content, plain: plain, repository: repository) 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 end
def no_highlight_files def no_highlight_files
......
...@@ -25,9 +25,9 @@ module Banzai ...@@ -25,9 +25,9 @@ module Banzai
begin begin
highlighted = '' highlighted = ''
highlighted << %<<pre class="#{css_classes}"><code>> highlighted << %(<pre class="#{css_classes}"><code>)
highlighted << formatter.format(lexer.lex(code)) highlighted << formatter.format(lexer.lex(code))
highlighted << %<</code></pre>> highlighted << %(</code></pre>)
rescue rescue
# Gracefully handle syntax highlighter bugs/errors to ensure # Gracefully handle syntax highlighter bugs/errors to ensure
# users can still access an issue/comment/etc. # users can still access an issue/comment/etc.
......
...@@ -17,9 +17,9 @@ module Rouge ...@@ -17,9 +17,9 @@ module Rouge
yield "\n" unless is_first yield "\n" unless is_first
is_first = false 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) } line.each { |token, value| yield span(token, value) }
yield %<</span>> yield %(</span>)
@line_number += 1 @line_number += 1
end end
......
...@@ -17,7 +17,7 @@ describe BlobHelper do ...@@ -17,7 +17,7 @@ describe BlobHelper do
describe '#highlight' do describe '#highlight' do
it 'should return plaintext for unknown lexer context' do it 'should return plaintext for unknown lexer context' do
result = helper.highlight(blob_name, no_context_content) 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 end
it 'should highlight single block' do it 'should highlight single block' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment