diff options
author | Fabio Pitino <fpitino@gitlab.com> | 2019-06-17 15:21:27 +0100 |
---|---|---|
committer | Fabio Pitino <fpitino@gitlab.com> | 2019-06-17 15:21:27 +0100 |
commit | cd6fc8b81fc18d438fb696862b6cd7a05ae7b1d5 (patch) | |
tree | 650d6f6a7c52a5d3651e6ae6e96a3ee1422f1f5f | |
parent | ad9079da5a397606aa5588731b5402117a3806bb (diff) | |
download | gitlab-ce-cd6fc8b81fc18d438fb696862b6cd7a05ae7b1d5.tar.gz |
Compact syntax for default class names
-rw-r--r-- | lib/gitlab/ci/ansi2html.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/ansi2html_spec.rb | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/gitlab/ci/ansi2html.rb b/lib/gitlab/ci/ansi2html.rb index dafa0087f3f..d20ed207b3f 100644 --- a/lib/gitlab/ci/ansi2html.rb +++ b/lib/gitlab/ci/ansi2html.rb @@ -197,9 +197,7 @@ module Gitlab css_classes = [] if @sections.any? - css_classes << "section" - css_classes += sections.map { |section| "s_#{section}" } - css_classes << "line" + css_classes = %w[section line] + sections.map { |section| "s_#{section}" } end write_in_tag %{<br/>} @@ -217,13 +215,13 @@ module Gitlab normalized_section = section_to_class_name(section) if action == "start" - handle_section_start(normalized_section, timestamp, line) + handle_section_start(normalized_section, timestamp) elsif action == "end" handle_section_end(normalized_section, timestamp) end end - def handle_section_start(section, timestamp, line) + def handle_section_start(section, timestamp) return if @sections.include?(section) @sections << section diff --git a/spec/lib/gitlab/ci/ansi2html_spec.rb b/spec/lib/gitlab/ci/ansi2html_spec.rb index 03a73e253e0..ac4612dda92 100644 --- a/spec/lib/gitlab/ci/ansi2html_spec.rb +++ b/spec/lib/gitlab/ci/ansi2html_spec.rb @@ -233,7 +233,7 @@ describe Gitlab::Ci::Ansi2html do text = "#{section_start}\e[91mHello\e[0m\n#{section_end}" header = %{<span class="term-fg-l-red section js-section-header js-s-#{class_name(section_name)}">Hello</span>} line_break = %{<span class="section js-section-header js-s-#{class_name(section_name)}"><br/></span>} - line = %{<span class="section s_#{class_name(section_name)} line"></span>} + line = %{<span class="section line s_#{class_name(section_name)}"></span>} empty_line = %{<span class="section js-s-#{class_name(section_name)}"></span>} html = "#{section_start_html}#{header}#{line_break}#{line}#{empty_line}#{section_end_html}" |