Class: RDoc::Markup::ToTest

Inherits:
Formatter show all
Defined in:
lib/rdoc/markup/to_test.rb

Overview

This Markup outputter is used for testing purposes.

Instance Method Summary collapse

Methods inherited from Formatter

#accept_document, #add_regexp_handling_RDOCLINK, #add_regexp_handling_TIDYLINK, #add_tag, #annotate, #convert, #convert_flow, #convert_regexp_handling, #convert_string, #each_attr_tag, gen_relative_url, #ignore, #in_tt?, #initialize, #off_tags, #on_tags, #parse_url, #tt?, #tt_tag?

Constructor Details

This class inherits a constructor from RDoc::Markup::Formatter

Instance Method Details

#accept_blank_line(blank_line) ⇒ Object



55
56
57
# File 'lib/rdoc/markup/to_test.rb', line 55

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

#accept_heading(heading) ⇒ Object



59
60
61
# File 'lib/rdoc/markup/to_test.rb', line 59

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

#accept_list_end(list) ⇒ Object



44
45
46
# File 'lib/rdoc/markup/to_test.rb', line 44

def accept_list_end(list)
  @list.pop
end

#accept_list_item_end(list_item) ⇒ Object



52
53
# File 'lib/rdoc/markup/to_test.rb', line 52

def accept_list_item_end(list_item)
end

#accept_list_item_start(list_item) ⇒ Object



48
49
50
# File 'lib/rdoc/markup/to_test.rb', line 48

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

#accept_list_start(list) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/rdoc/markup/to_test.rb', line 33

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

#accept_paragraph(paragraph) ⇒ Object



21
22
23
# File 'lib/rdoc/markup/to_test.rb', line 21

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

#accept_raw(raw) ⇒ Object



25
26
27
# File 'lib/rdoc/markup/to_test.rb', line 25

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

#accept_rule(rule) ⇒ Object



63
64
65
# File 'lib/rdoc/markup/to_test.rb', line 63

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

#accept_verbatim(verbatim) ⇒ Object



29
30
31
# File 'lib/rdoc/markup/to_test.rb', line 29

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

#end_acceptingObject



17
18
19
# File 'lib/rdoc/markup/to_test.rb', line 17

def end_accepting
  @res
end

#start_acceptingObject

:section: Visitor



12
13
14
15
# File 'lib/rdoc/markup/to_test.rb', line 12

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