summaryrefslogtreecommitdiff
path: root/lib/rouge
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2016-06-21 11:23:10 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2016-07-14 10:08:15 -0700
commitd625f652916c7039797190351d1dc04c6152ce78 (patch)
treebf068995238b443fa824c5a203df369f24bb2e84 /lib/rouge
parent001b1ff312df04e014a82fdb831a77cfaf66fd62 (diff)
downloadgitlab-ce-d625f652916c7039797190351d1dc04c6152ce78.tar.gz
eliminate the final newline in <pre> blocks
Diffstat (limited to 'lib/rouge')
-rw-r--r--lib/rouge/formatters/html_gitlab.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/rouge/formatters/html_gitlab.rb b/lib/rouge/formatters/html_gitlab.rb
index 31533fc3b8c..b76cf14a536 100644
--- a/lib/rouge/formatters/html_gitlab.rb
+++ b/lib/rouge/formatters/html_gitlab.rb
@@ -12,10 +12,14 @@ module Rouge
end
def stream(tokens, &b)
+ is_first = true
token_lines(tokens) do |line|
+ yield "\n" unless is_first
+ is_first = false
+
yield %<<span id="LC#{@line_number}" class="line">>
line.each { |token, value| yield span(token, value) }
- yield %<</span>\n>
+ yield %<</span>>
@line_number += 1
end