diff options
author | http://jneen.net/ <jneen@jneen.net> | 2016-06-21 11:23:10 -0700 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2016-07-14 10:08:15 -0700 |
commit | d625f652916c7039797190351d1dc04c6152ce78 (patch) | |
tree | bf068995238b443fa824c5a203df369f24bb2e84 | |
parent | 001b1ff312df04e014a82fdb831a77cfaf66fd62 (diff) | |
download | gitlab-ce-d625f652916c7039797190351d1dc04c6152ce78.tar.gz |
eliminate the final newline in <pre> blocks
-rw-r--r-- | lib/rouge/formatters/html_gitlab.rb | 6 |
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 |