Sha256: 122939dc2e28a96d03166cbc685e97de42ac6aa0c5379d9216906d059e24cbd9

Contents?: true

Size: 1.14 KB

Versions: 19

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

19 entries across 17 versions & 7 rubygems

Version Path
rdoc-6.12.0 lib/rdoc/markup/to_test.rb
tailscale_middleware-0.0.3 vendor/cache/ruby/3.4.0/gems/rdoc-6.11.0/lib/rdoc/markup/to_test.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/rdoc-6.7.0/lib/rdoc/markup/to_test.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/rdoc-6.10.0/lib/rdoc/markup/to_test.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/rdoc-6.8.1/lib/rdoc/markup/to_test.rb
rdoc-6.11.0 lib/rdoc/markup/to_test.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rdoc-6.7.0/lib/rdoc/markup/to_test.rb
rdoc-6.10.0 lib/rdoc/markup/to_test.rb
rdoc-6.9.1 lib/rdoc/markup/to_test.rb
rdoc-6.9.0 lib/rdoc/markup/to_test.rb
rdoc-6.8.1 lib/rdoc/markup/to_test.rb
rdoc-6.8.0 lib/rdoc/markup/to_test.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rdoc-6.7.0/lib/rdoc/markup/to_test.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/rdoc-6.7.0/lib/rdoc/markup/to_test.rb
rdoc-6.6.3.1 lib/rdoc/markup/to_test.rb
rdoc-6.6.2 lib/rdoc/markup/to_test.rb
rdoc-6.6.1 lib/rdoc/markup/to_test.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/rdoc-6.6.0/lib/rdoc/markup/to_test.rb
rdoc-6.6.0 lib/rdoc/markup/to_test.rb