Class: RDoc::Markup::ToTest

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

Overview

This Markup outputter is used for testing purposes.

Instance Method Summary collapse

Instance Method Details

#accept_blank_line(blank_line) ⇒ Object



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

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

#accept_heading(heading) ⇒ Object



69
70
71
# File 'lib/rdoc/markup/to_test.rb', line 69

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

#accept_list_end(list) ⇒ Object



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

def accept_list_end(list)
  @list.pop
end

#accept_list_item_end(list_item) ⇒ Object



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

def accept_list_item_end(list_item)
end

#accept_list_item_start(list_item) ⇒ Object



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

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

#accept_list_start(list) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/rdoc/markup/to_test.rb', line 43

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

#accept_paragraph(paragraph) ⇒ Object



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

def accept_paragraph(paragraph)
  handle_inline(paragraph.text)
end

#accept_raw(raw) ⇒ Object



35
36
37
# File 'lib/rdoc/markup/to_test.rb', line 35

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

#accept_rule(rule) ⇒ Object



73
74
75
# File 'lib/rdoc/markup/to_test.rb', line 73

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

#accept_verbatim(verbatim) ⇒ Object



39
40
41
# File 'lib/rdoc/markup/to_test.rb', line 39

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

#end_accepting ⇒ Object



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

def end_accepting
  @res
end

#handle_PLAIN_TEXT(text) ⇒ Object



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

def handle_PLAIN_TEXT(text)
  @res << text
end

#handle_REGEXP_HANDLING_TEXT(text) ⇒ Object



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

def handle_REGEXP_HANDLING_TEXT(text)
  @res << text
end

#start_accepting ⇒ Object

:section: Visitor



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

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