diff --git a/lib/gitlab/ci/ansi2html.rb b/lib/gitlab/ci/ansi2html.rb
index fc3223e7442ed1a5e4603e107a02a9a1b7b89b41..55411b5a8c49d32c0935be62aeb0504bc2f7f72e 100644
--- a/lib/gitlab/ci/ansi2html.rb
+++ b/lib/gitlab/ci/ansi2html.rb
@@ -200,7 +200,9 @@ module Gitlab
css_classes = %w[section line] + sections.map { |section| "s_#{section}" }
end
- write_in_tag %{
}
+ ensure_open_new_tag
+ write_raw %{
}
+ close_open_tags
write_raw %{} if css_classes.any?
@lineno_in_section += 1
open_new_tag
diff --git a/spec/lib/gitlab/ci/ansi2html_spec.rb b/spec/lib/gitlab/ci/ansi2html_spec.rb
index 3d57ce431ab81016b93ca18cafc45c0ef24f9b58..aa4e358b1486ab01de6c7159f7a549ad8b23f3d9 100644
--- a/spec/lib/gitlab/ci/ansi2html_spec.rb
+++ b/spec/lib/gitlab/ci/ansi2html_spec.rb
@@ -141,11 +141,11 @@ describe Gitlab::Ci::Ansi2html do
end
it "replaces newlines with line break tags" do
- expect(convert_html("\n")).to eq('
')
+ expect(convert_html("\n")).to eq('
')
end
it "groups carriage returns with newlines" do
- expect(convert_html("\r\n")).to eq('
')
+ expect(convert_html("\r\n")).to eq('
')
end
describe "incremental update" do
@@ -193,7 +193,7 @@ describe Gitlab::Ci::Ansi2html do
let(:pre_text) { "Hello\r" }
let(:pre_html) { "Hello\r" }
let(:text) { "\nWorld" }
- let(:html) { "
World" }
+ let(:html) { "
World" }
it_behaves_like 'stateable converter'
end
@@ -232,7 +232,7 @@ describe Gitlab::Ci::Ansi2html do
it 'prints light red' do
text = "#{section_start}\e[91mHello\e[0m\n#{section_end}"
header = %{}
- line_break = %{}
+ line_break = %{
}
line = %{}
empty_line = %{}
html = "#{section_start_html}#{header}#{line_break}#{line}#{empty_line}#{section_end_html}"
diff --git a/spec/lib/gitlab/ci/trace/stream_spec.rb b/spec/lib/gitlab/ci/trace/stream_spec.rb
index 35250632e86742477094c2f9861c25e4017e2040..0d03eef99c86e102e5d6c539993b8d8daa69bdf5 100644
--- a/spec/lib/gitlab/ci/trace/stream_spec.rb
+++ b/spec/lib/gitlab/ci/trace/stream_spec.rb
@@ -65,9 +65,9 @@ describe Gitlab::Ci::Trace::Stream, :clean_gitlab_redis_cache do
result = stream.html
expect(result).to eq(
- "ヾ(´༎ຶД༎ຶ`)ノ
"\
- "許功蓋
"\
- "")
+ "ヾ(´༎ຶД༎ຶ`)ノ
"\
+ "許功蓋
"\
+ "")
expect(result.encoding).to eq(Encoding.default_external)
end
end
@@ -306,8 +306,8 @@ describe Gitlab::Ci::Trace::Stream, :clean_gitlab_redis_cache do
shared_examples_for 'htmls' do
it "returns html" do
expect(stream.html).to eq(
- "12
34
"\
- "56")
+ "12
34
"\
+ "56")
end
it "returns html for last line only" do
diff --git a/spec/support/shared_examples/ci_trace_shared_examples.rb b/spec/support/shared_examples/ci_trace_shared_examples.rb
index f985b2dcbba75501e2aac2cd99f16d17d9a21be6..7993b2870e5b8bc6a709ddec082cfe1e535e06ac 100644
--- a/spec/support/shared_examples/ci_trace_shared_examples.rb
+++ b/spec/support/shared_examples/ci_trace_shared_examples.rb
@@ -5,7 +5,7 @@ shared_examples_for 'common trace features' do
end
it "returns formatted html" do
- expect(trace.html).to eq("12
34")
+ expect(trace.html).to eq("12
34")
end
it "returns last line of formatted html" do