diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-01-09 15:50:05 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-01-09 15:50:05 +0000 |
commit | 6c62482144e786f83ed62298e06604e46e93107e (patch) | |
tree | 68e605024be118c8426a2a83df0d1dc3dfbe0e07 | |
parent | 583deef209af5a2700701fb0933582a7b5680620 (diff) | |
parent | 76eec7ba54aa7077005aa55bfc8581c2a48b8083 (diff) | |
download | gitlab-ce-6c62482144e786f83ed62298e06604e46e93107e.tar.gz |
Merge branch '19086-double-newline' into 'master'
Fix Double Spaced CI Log
Closes #19086
See merge request !8349
-rw-r--r-- | changelogs/unreleased/19086-double-newline.yml | 4 | ||||
-rw-r--r-- | lib/ci/ansi2html.rb | 2 | ||||
-rw-r--r-- | spec/lib/ci/ansi2html_spec.rb | 8 |
3 files changed, 13 insertions, 1 deletions
diff --git a/changelogs/unreleased/19086-double-newline.yml b/changelogs/unreleased/19086-double-newline.yml new file mode 100644 index 00000000000..dd9b58920fb --- /dev/null +++ b/changelogs/unreleased/19086-double-newline.yml @@ -0,0 +1,4 @@ +--- +title: Fix double spaced CI log +merge_request: 8349 +author: Jared Deckard <jared.deckard@gmail.com> diff --git a/lib/ci/ansi2html.rb b/lib/ci/ansi2html.rb index 229050151d3..c10d3616f31 100644 --- a/lib/ci/ansi2html.rb +++ b/lib/ci/ansi2html.rb @@ -105,7 +105,7 @@ module Ci break elsif s.scan(/</) @out << '<' - elsif s.scan(/\n/) + elsif s.scan(/\r?\n/) @out << '<br>' else @out << s.scan(/./m) diff --git a/spec/lib/ci/ansi2html_spec.rb b/spec/lib/ci/ansi2html_spec.rb index 898f1e84ab0..0762fd7e56a 100644 --- a/spec/lib/ci/ansi2html_spec.rb +++ b/spec/lib/ci/ansi2html_spec.rb @@ -136,6 +136,14 @@ describe Ci::Ansi2html, lib: true do expect(subject.convert("<")[:html]).to eq('<') end + it "replaces newlines with line break tags" do + expect(subject.convert("\n")[:html]).to eq('<br>') + end + + it "groups carriage returns with newlines" do + expect(subject.convert("\r\n")[:html]).to eq('<br>') + end + describe "incremental update" do shared_examples 'stateable converter' do let(:pass1) { subject.convert(pre_text) } |