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_special_RDOCLINK, #add_special_TIDYLINK, #add_tag, #annotate, #convert, #convert_flow, #convert_special, #convert_string, gen_relative_url, #ignore, #in_tt?, #initialize, #off_tags, #on_tags, #parse_url, #tt?

Constructor Details

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

Instance Method Details

#accept_blank_line(blank_line) ⇒ Object



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

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

#accept_heading(heading) ⇒ Object



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

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

#accept_list_end(list) ⇒ Object



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

def accept_list_end(list)
  @list.pop
end

#accept_list_item_end(list_item) ⇒ Object



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

def accept_list_item_end(list_item)
end

#accept_list_item_start(list_item) ⇒ Object



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

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

#accept_list_start(list) ⇒ Object



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

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



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

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

#accept_raw(raw) ⇒ Object



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

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

#accept_rule(rule) ⇒ Object



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

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

#accept_verbatim(verbatim) ⇒ Object



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

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

#end_acceptingObject



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

def end_accepting
  @res
end

#start_acceptingObject

:section: Visitor



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

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