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
This commit is contained in:
hsbt 2017-09-12 03:42:54 +00:00
parent 65b11a04f1
commit 214a7f8d49
23 changed files with 1472 additions and 3227 deletions

View file

@ -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