Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2019-08-02 17:38:51 +0300
committerFatih Acet <acetfatih@gmail.com>2019-08-02 17:38:51 +0300
commiteb2d4adf38726da62f62e850d181cedf12c64c5e (patch)
tree037c50677bea22d8e0b1733f210e08de01e32962 /lib/gitlab
parent0fec9a4fc7fae7480a92d6402d3ad144b4bd7233 (diff)
parentfc9f099884f6b98dea3f4e6110ecba6151fa75b8 (diff)
Merge branch 'leipert-improve-ansi2html' into 'master'
Improve job log rendering performance See merge request gitlab-org/gitlab-ce!31262
Diffstat (limited to 'lib/gitlab')
-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