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_tag, #annotate, #convert, #convert_flow, #convert_special, #convert_string, #in_tt?, #initialize, #off_tags, #on_tags, #tt?

Constructor Details

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

Instance Method Details

#accept_blank_line(blank_line) ⇒ Object



57
58
59
# File 'lib/rdoc/markup/to_test.rb', line 57

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

#accept_heading(heading) ⇒ Object



61
62
63
# File 'lib/rdoc/markup/to_test.rb', line 61

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

#accept_list_end(list) ⇒ Object



46
47
48
# File 'lib/rdoc/markup/to_test.rb', line 46

def accept_list_end(list)
  @list.pop
end

#accept_list_item_end(list_item) ⇒ Object



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

def accept_list_item_end(list_item)
end

#accept_list_item_start(list_item) ⇒ Object



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

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

#accept_list_start(list) ⇒ Object



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

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



23
24
25
# File 'lib/rdoc/markup/to_test.rb', line 23

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

#accept_raw(raw) ⇒ Object



27
28
29
# File 'lib/rdoc/markup/to_test.rb', line 27

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

#accept_rule(rule) ⇒ Object



65
66
67
# File 'lib/rdoc/markup/to_test.rb', line 65

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

#accept_verbatim(verbatim) ⇒ Object



31
32
33
# File 'lib/rdoc/markup/to_test.rb', line 31

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

#end_acceptingObject



19
20
21
# File 'lib/rdoc/markup/to_test.rb', line 19

def end_accepting
  @res
end

#start_acceptingObject

:section: Visitor



14
15
16
17
# File 'lib/rdoc/markup/to_test.rb', line 14

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