summaryrefslogtreecommitdiff
path: root/lib/ci/ansi2html.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ci/ansi2html.rb')
-rw-r--r--lib/ci/ansi2html.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ci/ansi2html.rb b/lib/ci/ansi2html.rb
index 5fed43aaebd..229050151d3 100644
--- a/lib/ci/ansi2html.rb
+++ b/lib/ci/ansi2html.rb
@@ -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]
@@ -98,13 +98,15 @@ module Ci
open_new_tag
s = StringScanner.new(ansi)
- while(!s.eos?)
+ until s.eos?
if s.scan(/\e([@-_])(.*?)([@-~])/)
handle_sequence(s)
elsif s.scan(/\e(([@-_])(.*?)?)?$/)
break
elsif s.scan(/</)
@out << '&lt;'
+ elsif s.scan(/\n/)
+ @out << '<br>'
else
@out << s.scan(/./m)
end