Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions lib/rdoc/token_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,7 @@ def self.to_html(token_stream)
then 'ruby-identifier'
end

comment_with_nl = false
if :on_comment == t[:kind] or :on_embdoc == t[:kind] or :on_heredoc_end == t[:kind]
comment_with_nl = true if "\n" == t[:text][-1]
text = t[:text].rstrip
else
text = t[:text]
end
text = t[:text]

if :on_ident == t[:kind] && starting_title
starting_title = false
Expand All @@ -65,7 +59,11 @@ def self.to_html(token_stream)
text = CGI.escapeHTML text

if style then
"<span class=\"#{style}\">#{text}</span>#{"\n" if comment_with_nl}"
if text.end_with?("\n")
newline = "\n"
text = text.byteslice(0...-1)
end
"<span class=\"#{style}\">#{text}</span>#{newline}"
else
text
end
Expand Down