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, #annotate, #apply_regexp_handling, #convert, #convert_string, gen_relative_url, #handle_BOLD, #handle_BOLD_WORD, #handle_EM, #handle_EM_WORD, #handle_HARD_BREAK, #handle_STRIKE, #handle_TEXT, #handle_TIDYLINK, #handle_TT, #handle_inline, #ignore, #initialize, #parse_url, #traverse_inline_nodes, #tt?

Constructor Details

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

Instance Method Details

#accept_blank_line(blank_line) ⇒ Object



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

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

#accept_heading(heading) ⇒ Object



67
68
69
# File 'lib/rdoc/markup/to_test.rb', line 67

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

#accept_list_end(list) ⇒ Object



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

def accept_list_end(list)
  @list.pop
end

#accept_list_item_end(list_item) ⇒ Object



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

def accept_list_item_end(list_item)
end

#accept_list_item_start(list_item) ⇒ Object



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

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

#accept_list_start(list) ⇒ Object



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

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



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

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

#accept_raw(raw) ⇒ Object



33
34
35
# File 'lib/rdoc/markup/to_test.rb', line 33

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

#accept_rule(rule) ⇒ Object



71
72
73
# File 'lib/rdoc/markup/to_test.rb', line 71

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

#accept_verbatim(verbatim) ⇒ Object



37
38
39
# File 'lib/rdoc/markup/to_test.rb', line 37

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

#handle_PLAIN_TEXT(text) ⇒ Object



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

def handle_PLAIN_TEXT(text)
  @res << text
end

#handle_REGEXP_HANDLING_TEXT(text) ⇒ Object



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

def handle_REGEXP_HANDLING_TEXT(text)
  @res << text
end

#start_acceptingObject

:section: Visitor



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

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