eliminate the final newline in <pre> blocks
This commit is contained in:
parent
001b1ff312
commit
d625f65291
1 changed files with 5 additions and 1 deletions
|
@ -12,10 +12,14 @@ module Rouge
|
||||||
end
|
end
|
||||||
|
|
||||||
def stream(tokens, &b)
|
def stream(tokens, &b)
|
||||||
|
is_first = true
|
||||||
token_lines(tokens) do |line|
|
token_lines(tokens) do |line|
|
||||||
|
yield "\n" unless is_first
|
||||||
|
is_first = false
|
||||||
|
|
||||||
yield %<<span id="LC#{@line_number}" class="line">>
|
yield %<<span id="LC#{@line_number}" class="line">>
|
||||||
line.each { |token, value| yield span(token, value) }
|
line.each { |token, value| yield span(token, value) }
|
||||||
yield %<</span>\n>
|
yield %<</span>>
|
||||||
|
|
||||||
@line_number += 1
|
@line_number += 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue