Sha256: fe0f1fde508d06e1fe7225881dc626b48afb7e951d2cec45937dbb9b99d03d0b

Contents?: true

Size: 634 Bytes

Versions: 20

Compression:

Stored size: 634 Bytes

Contents

##
# A section of verbatim text

class RDoc::Markup::Verbatim < RDoc::Markup::Raw

  ##
  # Calls #accept_verbatim on +visitor+

  def accept visitor
    visitor.accept_verbatim self
  end

  ##
  # Collapses 3+ newlines into two newlines

  def normalize
    parts = []

    newlines = 0

    @parts.each do |part|
      case part
      when /^\s*\n/ then
        newlines += 1
        parts << part if newlines == 1
      else
        newlines = 0
        parts << part
      end
    end

    parts.pop if parts.last =~ /\A\r?\n\z/

    @parts = parts
  end

  ##
  # The text of the section

  def text
    @parts.join
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rdoc-3.9.5 lib/rdoc/markup/verbatim.rb
rdoc-3.9.4 lib/rdoc/markup/verbatim.rb
rdoc-3.9.3 lib/rdoc/markup/verbatim.rb
rdoc-3.9.2 lib/rdoc/markup/verbatim.rb
rdoc-3.9.1 lib/rdoc/markup/verbatim.rb
rdoc-3.9 lib/rdoc/markup/verbatim.rb
rdoc-3.8 lib/rdoc/markup/verbatim.rb
rdoc-3.7 lib/rdoc/markup/verbatim.rb
rdoc-3.6.1 lib/rdoc/markup/verbatim.rb
rdoc-3.6 lib/rdoc/markup/verbatim.rb
rdoc-3.5.3 lib/rdoc/markup/verbatim.rb
rdoc-3.5.2 lib/rdoc/markup/verbatim.rb
rdoc-3.5.1 lib/rdoc/markup/verbatim.rb
rdoc-3.5 lib/rdoc/markup/verbatim.rb
rdoc-3.4 lib/rdoc/markup/verbatim.rb
rdoc-3.3 lib/rdoc/markup/verbatim.rb
rdoc-3.2 lib/rdoc/markup/verbatim.rb
rdoc-3.1 lib/rdoc/markup/verbatim.rb
rdoc-3.0.1 lib/rdoc/markup/verbatim.rb
rdoc-3.0 lib/rdoc/markup/verbatim.rb