Skip to content
Snippets Groups Projects
Commit cdec9e47 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Replace \n to <br>

parent 46de0366
No related branches found
No related tags found
No related merge requests found
Loading
@@ -33,8 +33,10 @@ class CiBuild
Loading
@@ -33,8 +33,10 @@ class CiBuild
url: build_url + "/trace.json?state=" + encodeURIComponent(@state) url: build_url + "/trace.json?state=" + encodeURIComponent(@state)
dataType: "json" dataType: "json"
success: (log) => success: (log) =>
if last_state is @state and log.status is "running" return unless last_state is @state
@state = if log.state then log.state else ""
if log.state and log.status is "running"
@state = log.state
if log.append if log.append
$('.fa-refresh').before log.html $('.fa-refresh').before log.html
else else
Loading
Loading
Loading
@@ -90,7 +90,7 @@ module Ci
Loading
@@ -90,7 +90,7 @@ module Ci
   
def convert(raw, new_state) def convert(raw, new_state)
reset_state reset_state
restore_state(raw, new_state) if new_state restore_state(raw, new_state) if new_state.present?
   
start = @offset start = @offset
ansi = raw[@offset..-1] ansi = raw[@offset..-1]
Loading
@@ -105,6 +105,8 @@ module Ci
Loading
@@ -105,6 +105,8 @@ module Ci
break break
elsif s.scan(/</) elsif s.scan(/</)
@out << '&lt;' @out << '&lt;'
elsif s.scan(/\n/)
@out << '<br>'
else else
@out << s.scan(/./m) @out << s.scan(/./m)
end end
Loading
Loading
Loading
@@ -175,5 +175,14 @@ describe Ci::Ansi2html, lib: true do
Loading
@@ -175,5 +175,14 @@ describe Ci::Ansi2html, lib: true do
   
it_behaves_like 'stateable converter' it_behaves_like 'stateable converter'
end 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
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment