Sha256: 5441925009f00c194de16f12d8ef45f0050a7597d858e2c870eba9841a033db7

Contents?: true

Size: 1.14 KB

Versions: 32

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true
##
# This Markup outputter is used for testing purposes.

class RDoc::Markup::ToTest < RDoc::Markup::Formatter

  # :stopdoc:

  ##
  # :section: Visitor

  def start_accepting
    @res = []
    @list = []
  end

  def end_accepting
    @res
  end

  def accept_paragraph(paragraph)
    @res << convert_flow(@am.flow(paragraph.text))
  end

  def accept_raw raw
    @res << raw.parts.join
  end

  def accept_verbatim(verbatim)
    @res << verbatim.text.gsub(/^(\S)/, '  \1')
  end

  def accept_list_start(list)
    @list << case list.type
             when :BULLET then
               '*'
             when :NUMBER then
               '1'
             else
               list.type
             end
  end

  def accept_list_end(list)
    @list.pop
  end

  def accept_list_item_start(list_item)
    @res << "#{' ' * (@list.size - 1)}#{@list.last}: "
  end

  def accept_list_item_end(list_item)
  end

  def accept_blank_line(blank_line)
    @res << "\n"
  end

  def accept_heading(heading)
    @res << "#{'=' * heading.level} #{heading.text}"
  end

  def accept_rule(rule)
    @res << '-' * rule.weight
  end

  # :startdoc:

end

Version data entries

32 entries across 32 versions & 4 rubygems

Version Path
rdoc-6.5.1.1 lib/rdoc/markup/to_test.rb
rdoc-6.4.1.1 lib/rdoc/markup/to_test.rb
rdoc-6.3.4.1 lib/rdoc/markup/to_test.rb
rdoc-6.5.0 lib/rdoc/markup/to_test.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/rdoc-6.4.0/lib/rdoc/markup/to_test.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/rdoc-6.4.0/lib/rdoc/markup/to_test.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/rdoc-6.4.0/lib/rdoc/markup/to_test.rb
rdoc-6.4.0 lib/rdoc/markup/to_test.rb
rdoc-6.3.3 lib/rdoc/markup/to_test.rb
rdoc-6.1.2.1 lib/rdoc/markup/to_test.rb
rdoc-6.3.2 lib/rdoc/markup/to_test.rb
gitlab-rdoc-6.3.2 lib/rdoc/markup/to_test.rb
rdoc-6.3.1 lib/rdoc/markup/to_test.rb
rdoc-6.3.0 lib/rdoc/markup/to_test.rb
rdoc-6.2.1 lib/rdoc/markup/to_test.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/rdoc-6.1.1/lib/rdoc/markup/to_test.rb
rdoc-6.2.0 lib/rdoc/markup/to_test.rb
rdoc-6.1.2 lib/rdoc/markup/to_test.rb
rdoc-6.0.1.1 lib/rdoc/markup/to_test.rb
ric-0.13.0 vendor/bundle/ruby/2.5.0/gems/rdoc-6.1.1/lib/rdoc/markup/to_test.rb