summaryrefslogtreecommitdiff
path: root/lib/rdoc/markup
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-12 03:42:54 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-12 03:42:54 +0000
commit214a7f8d49c7b59d06f5e2e3e1a8a3567ab7c570 (patch)
tree382d9b6a7989ada3d73912c9423e714cd08e8f5f /lib/rdoc/markup
parent65b11a04f10a2438f0d6ba263a78d16367c3aac0 (diff)
Merge rdoc-6.0.0.beta2 from upstream.
* This version changed lexer used Ripper from lexer based IRB. see details: https://github.com/ruby/rdoc/pull/512 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/markup')
-rw-r--r--lib/rdoc/markup/to_html.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index aa5de7bf66..98ed7926fd 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -200,10 +200,12 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
content = if verbatim.ruby? or parseable? text then
begin
- tokens = RDoc::RubyLex.tokenize text, @options
+ tokens = RDoc::RipperStateLex.parse text
klass = ' class="ruby"'
- RDoc::TokenStream.to_html tokens
+ result = RDoc::TokenStream.to_html tokens
+ result = result + "\n" unless "\n" == result[-1]
+ result
rescue RDoc::RubyLex::Error
CGI.escapeHTML text
end
@@ -212,7 +214,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
end
if @options.pipe then
- @res << "\n<pre><code>#{CGI.escapeHTML text}</code></pre>\n"
+ @res << "\n<pre><code>#{CGI.escapeHTML text}\n</code></pre>\n"
else
@res << "\n<pre#{klass}>#{content}</pre>\n"
end