summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/ansi2html.rb
diff options
context:
space:
mode:
authorSean Carroll <scarroll@gitlab.com>2019-08-05 09:16:25 +0000
committerSean Carroll <scarroll@gitlab.com>2019-08-05 09:16:25 +0000
commit09d5ad822c52337b975843fd2d4e079ce1f5e932 (patch)
tree71486aac99b1651598e24f2edc045158eae7267b /lib/gitlab/ci/ansi2html.rb
parent23d393e38788dc9af022916b1465b9c3a3e3f3f3 (diff)
parentfccbe0f97a76ba85daf745b4dd98375a5cd8f03f (diff)
downloadgitlab-ce-09d5ad822c52337b975843fd2d4e079ce1f5e932.tar.gz
Merge branch 'master' into '55360-redundant-index-in-the-releases-table'55360-redundant-index-in-the-releases-table
# Conflicts: # db/schema.rb
Diffstat (limited to 'lib/gitlab/ci/ansi2html.rb')
-rw-r--r--lib/gitlab/ci/ansi2html.rb27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/gitlab/ci/ansi2html.rb b/lib/gitlab/ci/ansi2html.rb
index fc3223e7442..7e348763e81 100644
--- a/lib/gitlab/ci/ansi2html.rb
+++ b/lib/gitlab/ci/ansi2html.rb
@@ -194,16 +194,10 @@ module Gitlab
end
def handle_new_line
- css_classes = []
-
- if @sections.any?
- css_classes = %w[section line] + sections.map { |section| "s_#{section}" }
- end
-
write_in_tag %{<br/>}
- write_raw %{<span class="#{css_classes.join(' ')}"></span>} if css_classes.any?
+
+ close_open_tags if @sections.any? && @lineno_in_section == 0
@lineno_in_section += 1
- open_new_tag
end
def handle_section(scanner)
@@ -310,11 +304,24 @@ module Gitlab
if @sections.any?
css_classes << "section"
- css_classes << "js-section-header section-header" if @lineno_in_section == 0
+
+ css_classes << if @lineno_in_section == 0
+ "js-section-header section-header"
+ else
+ "line"
+ end
+
css_classes += sections.map { |section| "js-s-#{section}" }
end
- @out << %{<span class="#{css_classes.join(' ')}">}
+ close_open_tags
+
+ @out << if css_classes.any?
+ %{<span class="#{css_classes.join(' ')}">}
+ else
+ %{<span>}
+ end
+
@n_open_tags += 1
end