Compact syntax for default class names
This commit is contained in:
parent
ad9079da5a
commit
cd6fc8b81f
2 changed files with 4 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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}"
|
||||
|
||||
|
|
Loading…
Reference in a new issue