diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 03:22:49 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 03:22:49 +0000 |
commit | 2ef9c50c6e405717d06362787c4549ca4f1c6485 (patch) | |
tree | ee99486567461dd5796f3d6edcc9e204187f2666 /lib/rdoc/markup/verbatim.rb | |
parent | d7effd506f5b91a636f2e6452ef1946b923007c7 (diff) | |
download | ruby-2ef9c50c6e405717d06362787c4549ca4f1c6485.tar.gz |
Import RDoc 3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/markup/verbatim.rb')
-rw-r--r-- | lib/rdoc/markup/verbatim.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/rdoc/markup/verbatim.rb b/lib/rdoc/markup/verbatim.rb index c684d78765..8fe2184699 100644 --- a/lib/rdoc/markup/verbatim.rb +++ b/lib/rdoc/markup/verbatim.rb @@ -3,6 +3,9 @@ class RDoc::Markup::Verbatim < RDoc::Markup::Raw + ## + # Calls #accept_verbatim on +visitor+ + def accept visitor visitor.accept_verbatim self end @@ -17,16 +20,16 @@ class RDoc::Markup::Verbatim < RDoc::Markup::Raw @parts.each do |part| case part - when /\n/ then + when /^\s*\n/ then newlines += 1 - parts << part if newlines <= 2 + parts << part if newlines == 1 else newlines = 0 parts << part end end - parts.slice!(-1) if parts[-2..-1] == ["\n", "\n"] + parts.pop if parts.last =~ /\A\r?\n\z/ @parts = parts end |