mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-09 12:46:07 +10:00
Replace \n to <br>
This commit is contained in:
@@ -33,8 +33,10 @@ class CiBuild
|
||||
url: build_url + "/trace.json?state=" + encodeURIComponent(@state)
|
||||
dataType: "json"
|
||||
success: (log) =>
|
||||
if last_state is @state and log.status is "running"
|
||||
@state = if log.state then log.state else ""
|
||||
return unless last_state is @state
|
||||
|
||||
if log.state and log.status is "running"
|
||||
@state = log.state
|
||||
if log.append
|
||||
$('.fa-refresh').before log.html
|
||||
else
|
||||
|
||||
+3
-1
@@ -90,7 +90,7 @@ module Ci
|
||||
|
||||
def convert(raw, new_state)
|
||||
reset_state
|
||||
restore_state(raw, new_state) if new_state
|
||||
restore_state(raw, new_state) if new_state.present?
|
||||
|
||||
start = @offset
|
||||
ansi = raw[@offset..-1]
|
||||
@@ -105,6 +105,8 @@ module Ci
|
||||
break
|
||||
elsif s.scan(/</)
|
||||
@out << '<'
|
||||
elsif s.scan(/\n/)
|
||||
@out << '<br>'
|
||||
else
|
||||
@out << s.scan(/./m)
|
||||
end
|
||||
|
||||
@@ -175,5 +175,14 @@ describe Ci::Ansi2html, lib: true do
|
||||
|
||||
it_behaves_like 'stateable converter'
|
||||
end
|
||||
|
||||
context 'with new line' do
|
||||
let(:pre_text) { "Hello\r" }
|
||||
let(:pre_html) { "Hello\r" }
|
||||
let(:text) { "\nWorld" }
|
||||
let(:html) { "<br>World" }
|
||||
|
||||
it_behaves_like 'stateable converter'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user