rdoc 6.12.0 → 6.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -1
  3. data/lib/rdoc/code_object/alias.rb +2 -9
  4. data/lib/rdoc/code_object/any_method.rb +9 -14
  5. data/lib/rdoc/code_object/attr.rb +6 -9
  6. data/lib/rdoc/code_object/class_module.rb +40 -23
  7. data/lib/rdoc/code_object/constant.rb +5 -5
  8. data/lib/rdoc/code_object/context/section.rb +8 -7
  9. data/lib/rdoc/code_object/context.rb +23 -65
  10. data/lib/rdoc/code_object/method_attr.rb +9 -28
  11. data/lib/rdoc/code_object/mixin.rb +3 -3
  12. data/lib/rdoc/code_object/normal_class.rb +1 -1
  13. data/lib/rdoc/code_object/normal_module.rb +1 -1
  14. data/lib/rdoc/code_object/require.rb +1 -1
  15. data/lib/rdoc/code_object/single_class.rb +1 -1
  16. data/lib/rdoc/code_object/top_level.rb +12 -30
  17. data/lib/rdoc/code_object.rb +6 -37
  18. data/lib/rdoc/comment.rb +7 -10
  19. data/lib/rdoc/cross_reference.rb +3 -3
  20. data/lib/rdoc/encoding.rb +4 -4
  21. data/lib/rdoc/erb_partial.rb +1 -1
  22. data/lib/rdoc/erbio.rb +2 -2
  23. data/lib/rdoc/generator/darkfish.rb +97 -109
  24. data/lib/rdoc/generator/json_index.rb +4 -20
  25. data/lib/rdoc/generator/markup.rb +14 -2
  26. data/lib/rdoc/generator/pot/message_extractor.rb +6 -6
  27. data/lib/rdoc/generator/pot/po.rb +1 -1
  28. data/lib/rdoc/generator/pot/po_entry.rb +7 -7
  29. data/lib/rdoc/generator/pot.rb +1 -6
  30. data/lib/rdoc/generator/ri.rb +1 -1
  31. data/lib/rdoc/generator/template/darkfish/_head.rhtml +5 -0
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -30
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
  35. data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
  36. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +15 -0
  37. data/lib/rdoc/markdown.kpeg +7 -5
  38. data/lib/rdoc/markdown.rb +34 -21
  39. data/lib/rdoc/markup/attribute_manager.rb +5 -5
  40. data/lib/rdoc/markup/attributes.rb +3 -3
  41. data/lib/rdoc/markup/blank_line.rb +2 -2
  42. data/lib/rdoc/markup/block_quote.rb +1 -1
  43. data/lib/rdoc/markup/document.rb +8 -8
  44. data/lib/rdoc/markup/formatter.rb +12 -12
  45. data/lib/rdoc/markup/hard_break.rb +3 -3
  46. data/lib/rdoc/markup/heading.rb +11 -5
  47. data/lib/rdoc/markup/include.rb +3 -3
  48. data/lib/rdoc/markup/indented_paragraph.rb +3 -3
  49. data/lib/rdoc/markup/list.rb +4 -4
  50. data/lib/rdoc/markup/list_item.rb +4 -4
  51. data/lib/rdoc/markup/paragraph.rb +2 -2
  52. data/lib/rdoc/markup/parser.rb +11 -11
  53. data/lib/rdoc/markup/pre_process.rb +6 -6
  54. data/lib/rdoc/markup/raw.rb +5 -5
  55. data/lib/rdoc/markup/rule.rb +2 -2
  56. data/lib/rdoc/markup/table.rb +4 -4
  57. data/lib/rdoc/markup/to_ansi.rb +3 -3
  58. data/lib/rdoc/markup/to_bs.rb +6 -6
  59. data/lib/rdoc/markup/to_html.rb +25 -16
  60. data/lib/rdoc/markup/to_html_crossref.rb +5 -5
  61. data/lib/rdoc/markup/to_html_snippet.rb +17 -17
  62. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
  63. data/lib/rdoc/markup/to_label.rb +6 -5
  64. data/lib/rdoc/markup/to_markdown.rb +12 -12
  65. data/lib/rdoc/markup/to_rdoc.rb +29 -28
  66. data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
  67. data/lib/rdoc/markup/to_test.rb +1 -1
  68. data/lib/rdoc/markup/to_tt_only.rb +8 -8
  69. data/lib/rdoc/markup/verbatim.rb +3 -3
  70. data/lib/rdoc/markup.rb +3 -3
  71. data/lib/rdoc/options.rb +31 -12
  72. data/lib/rdoc/parser/c.rb +20 -23
  73. data/lib/rdoc/parser/changelog.rb +9 -9
  74. data/lib/rdoc/parser/prism_ruby.rb +9 -16
  75. data/lib/rdoc/parser/ruby.rb +50 -53
  76. data/lib/rdoc/parser/simple.rb +2 -2
  77. data/lib/rdoc/parser.rb +8 -8
  78. data/lib/rdoc/rd/inline.rb +4 -4
  79. data/lib/rdoc/rd.rb +1 -1
  80. data/lib/rdoc/rdoc.rb +11 -26
  81. data/lib/rdoc/ri/driver.rb +60 -52
  82. data/lib/rdoc/ri/paths.rb +2 -2
  83. data/lib/rdoc/ri/task.rb +1 -1
  84. data/lib/rdoc/rubygems_hook.rb +14 -17
  85. data/lib/rdoc/servlet.rb +23 -22
  86. data/lib/rdoc/stats/normal.rb +1 -1
  87. data/lib/rdoc/stats/quiet.rb +1 -1
  88. data/lib/rdoc/stats/verbose.rb +3 -3
  89. data/lib/rdoc/stats.rb +14 -14
  90. data/lib/rdoc/store.rb +39 -43
  91. data/lib/rdoc/task.rb +2 -2
  92. data/lib/rdoc/text.rb +13 -13
  93. data/lib/rdoc/token_stream.rb +1 -1
  94. data/lib/rdoc/tom_doc.rb +7 -7
  95. data/lib/rdoc/version.rb +1 -1
  96. data/man/ri.1 +2 -0
  97. data/rdoc.gemspec +69 -0
  98. metadata +18 -5
  99. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  100. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
@@ -34,7 +34,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
34
34
  # next word boundary after the given number of +characters+ or +paragraphs+
35
35
  # of text have been encountered.
36
36
 
37
- def initialize options, characters = 100, paragraphs = 3, markup = nil
37
+ def initialize(options, characters = 100, paragraphs = 3, markup = nil)
38
38
  super options, markup
39
39
 
40
40
  @character_limit = characters
@@ -50,7 +50,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
50
50
  ##
51
51
  # Adds +heading+ to the output as a paragraph
52
52
 
53
- def accept_heading heading
53
+ def accept_heading(heading)
54
54
  @res << "<p>#{to_html heading.text}\n"
55
55
 
56
56
  add_paragraph
@@ -69,7 +69,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
69
69
  ##
70
70
  # Adds +paragraph+ to the output
71
71
 
72
- def accept_paragraph paragraph
72
+ def accept_paragraph(paragraph)
73
73
  para = @in_list_entry.last || "<p>"
74
74
 
75
75
  text = paragraph.text @hard_break
@@ -82,20 +82,20 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
82
82
  ##
83
83
  # Finishes consumption of +list_item+
84
84
 
85
- def accept_list_item_end list_item
85
+ def accept_list_item_end(list_item)
86
86
  end
87
87
 
88
88
  ##
89
89
  # Prepares the visitor for consuming +list_item+
90
90
 
91
- def accept_list_item_start list_item
91
+ def accept_list_item_start(list_item)
92
92
  @res << list_item_start(list_item, @list.last)
93
93
  end
94
94
 
95
95
  ##
96
96
  # Prepares the visitor for consuming +list+
97
97
 
98
- def accept_list_start list
98
+ def accept_list_start(list)
99
99
  @list << list.type
100
100
  @res << html_list_name(list.type, true)
101
101
  @in_list_entry.push ''
@@ -104,7 +104,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
104
104
  ##
105
105
  # Adds +verbatim+ to the output
106
106
 
107
- def accept_verbatim verbatim
107
+ def accept_verbatim(verbatim)
108
108
  throw :done if @characters >= @character_limit
109
109
  input = verbatim.text.rstrip
110
110
 
@@ -128,14 +128,14 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
128
128
  ##
129
129
  # Removes escaping from the cross-references in +target+
130
130
 
131
- def handle_regexp_CROSSREF target
131
+ def handle_regexp_CROSSREF(target)
132
132
  target.text.sub(/\A\\/, '')
133
133
  end
134
134
 
135
135
  ##
136
136
  # +target+ is a <code><br></code>
137
137
 
138
- def handle_regexp_HARD_BREAK target
138
+ def handle_regexp_HARD_BREAK(target)
139
139
  @characters -= 4
140
140
  '<br>'
141
141
  end
@@ -143,7 +143,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
143
143
  ##
144
144
  # Lists are paragraphs, but notes and labels have a separator
145
145
 
146
- def list_item_start list_item, list_type
146
+ def list_item_start(list_item, list_type)
147
147
  throw :done if @characters >= @character_limit
148
148
 
149
149
  case list_type
@@ -168,7 +168,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
168
168
  # Returns just the text of +link+, +url+ is only used to determine the link
169
169
  # type.
170
170
 
171
- def gen_url url, text
171
+ def gen_url(url, text)
172
172
  if url =~ /^rdoc-label:([^:]*)(?::(.*))?/ then
173
173
  type = "link"
174
174
  elsif url =~ /([A-Za-z]+):(.*)/ then
@@ -188,7 +188,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
188
188
  ##
189
189
  # In snippets, there are no lists
190
190
 
191
- def html_list_name list_type, open_tag
191
+ def html_list_name(list_type, open_tag)
192
192
  ''
193
193
  end
194
194
 
@@ -204,7 +204,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
204
204
  ##
205
205
  # Marks up +content+
206
206
 
207
- def convert content
207
+ def convert(content)
208
208
  catch :done do
209
209
  return super
210
210
  end
@@ -215,7 +215,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
215
215
  ##
216
216
  # Converts flow items +flow+
217
217
 
218
- def convert_flow flow
218
+ def convert_flow(flow)
219
219
  throw :done if @characters >= @character_limit
220
220
 
221
221
  res = []
@@ -251,7 +251,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
251
251
  # Maintains a bitmask to allow HTML elements to be closed properly. See
252
252
  # RDoc::Markup::Formatter.
253
253
 
254
- def on_tags res, item
254
+ def on_tags(res, item)
255
255
  @mask ^= item.turn_on
256
256
 
257
257
  super
@@ -261,7 +261,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
261
261
  # Maintains a bitmask to allow HTML elements to be closed properly. See
262
262
  # RDoc::Markup::Formatter.
263
263
 
264
- def off_tags res, item
264
+ def off_tags(res, item)
265
265
  @mask ^= item.turn_off
266
266
 
267
267
  super
@@ -270,7 +270,7 @@ class RDoc::Markup::ToHtmlSnippet < RDoc::Markup::ToHtml
270
270
  ##
271
271
  # Truncates +text+ at the end of the first word after the character_limit.
272
272
 
273
- def truncate text
273
+ def truncate(text)
274
274
  length = text.length
275
275
  characters = @characters
276
276
  @characters += length
@@ -22,7 +22,7 @@ class RDoc::Markup::ToJoinedParagraph < RDoc::Markup::Formatter
22
22
  ##
23
23
  # Converts the parts of +paragraph+ to a single entry.
24
24
 
25
- def accept_paragraph paragraph
25
+ def accept_paragraph(paragraph)
26
26
  parts = paragraph.parts.chunk do |part|
27
27
  String === part
28
28
  end.flat_map do |string, chunk|
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
- require 'cgi/util'
2
+ require 'cgi/escape'
3
+ require 'cgi/util' unless defined?(CGI::EscapeExt)
3
4
 
4
5
  ##
5
6
  # Creates HTML-safe labels suitable for use in id attributes. Tidylinks are
@@ -13,7 +14,7 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
13
14
  ##
14
15
  # Creates a new formatter that will output HTML-safe labels
15
16
 
16
- def initialize markup = nil
17
+ def initialize(markup = nil)
17
18
  super nil, markup
18
19
 
19
20
  @markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
@@ -29,7 +30,7 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
29
30
  ##
30
31
  # Converts +text+ to an HTML-safe label
31
32
 
32
- def convert text
33
+ def convert(text)
33
34
  label = convert_flow @am.flow text
34
35
 
35
36
  CGI.escape(label).gsub('%', '-').sub(/^-/, '')
@@ -39,7 +40,7 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
39
40
  # Converts the CROSSREF +target+ to plain text, removing the suppression
40
41
  # marker, if any
41
42
 
42
- def handle_regexp_CROSSREF target
43
+ def handle_regexp_CROSSREF(target)
43
44
  text = target.text
44
45
 
45
46
  text.sub(/^\\/, '')
@@ -48,7 +49,7 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter
48
49
  ##
49
50
  # Converts the TIDYLINK +target+ to just the text part
50
51
 
51
- def handle_regexp_TIDYLINK target
52
+ def handle_regexp_TIDYLINK(target)
52
53
  text = target.text
53
54
 
54
55
  return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
@@ -9,7 +9,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
9
9
  ##
10
10
  # Creates a new formatter that will output Markdown format text
11
11
 
12
- def initialize markup = nil
12
+ def initialize(markup = nil)
13
13
  super
14
14
 
15
15
  @headings[1] = ['# ', '']
@@ -37,21 +37,21 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
37
37
  ##
38
38
  # Adds a newline to the output
39
39
 
40
- def handle_regexp_HARD_BREAK target
40
+ def handle_regexp_HARD_BREAK(target)
41
41
  " \n"
42
42
  end
43
43
 
44
44
  ##
45
45
  # Finishes consumption of `list`
46
46
 
47
- def accept_list_end list
47
+ def accept_list_end(list)
48
48
  super
49
49
  end
50
50
 
51
51
  ##
52
52
  # Finishes consumption of `list_item`
53
53
 
54
- def accept_list_item_end list_item
54
+ def accept_list_item_end(list_item)
55
55
  width = case @list_type.last
56
56
  when :BULLET then
57
57
  4
@@ -72,7 +72,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
72
72
  ##
73
73
  # Prepares the visitor for consuming `list_item`
74
74
 
75
- def accept_list_item_start list_item
75
+ def accept_list_item_start(list_item)
76
76
  type = @list_type.last
77
77
 
78
78
  case type
@@ -97,7 +97,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
97
97
  ##
98
98
  # Prepares the visitor for consuming `list`
99
99
 
100
- def accept_list_start list
100
+ def accept_list_start(list)
101
101
  case list.type
102
102
  when :BULLET, :LABEL, :NOTE then
103
103
  @list_index << nil
@@ -114,7 +114,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
114
114
  ##
115
115
  # Adds `rule` to the output
116
116
 
117
- def accept_rule rule
117
+ def accept_rule(rule)
118
118
  use_prefix or @res << ' ' * @indent
119
119
  @res << '-' * 3
120
120
  @res << "\n"
@@ -123,7 +123,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
123
123
  ##
124
124
  # Outputs `verbatim` indented 4 columns
125
125
 
126
- def accept_verbatim verbatim
126
+ def accept_verbatim(verbatim)
127
127
  indent = ' ' * (@indent + 4)
128
128
 
129
129
  verbatim.parts.each do |part|
@@ -137,7 +137,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
137
137
  ##
138
138
  # Creates a Markdown-style URL from +url+ with +text+.
139
139
 
140
- def gen_url url, text
140
+ def gen_url(url, text)
141
141
  scheme, url, = parse_url url
142
142
 
143
143
  "[#{text.sub(%r{^#{scheme}:/*}i, '')}](#{url})"
@@ -146,7 +146,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
146
146
  ##
147
147
  # Handles <tt>rdoc-</tt> type links for footnotes.
148
148
 
149
- def handle_rdoc_link url
149
+ def handle_rdoc_link(url)
150
150
  case url
151
151
  when /^rdoc-ref:/ then
152
152
  $'
@@ -166,7 +166,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
166
166
  ##
167
167
  # Converts the RDoc markup tidylink into a Markdown.style link.
168
168
 
169
- def handle_regexp_TIDYLINK target
169
+ def handle_regexp_TIDYLINK(target)
170
170
  text = target.text
171
171
 
172
172
  return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
@@ -184,7 +184,7 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
184
184
  ##
185
185
  # Converts the rdoc-...: links into a Markdown.style links.
186
186
 
187
- def handle_regexp_RDOCLINK target
187
+ def handle_regexp_RDOCLINK(target)
188
188
  handle_rdoc_link target.text
189
189
  end
190
190
 
@@ -3,6 +3,16 @@
3
3
  # Outputs RDoc markup as RDoc markup! (mostly)
4
4
 
5
5
  class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
6
+ DEFAULT_HEADINGS = {
7
+ 1 => ['= ', ''],
8
+ 2 => ['== ', ''],
9
+ 3 => ['=== ', ''],
10
+ 4 => ['==== ', ''],
11
+ 5 => ['===== ', ''],
12
+ 6 => ['====== ', '']
13
+ }
14
+ DEFAULT_HEADINGS.default = []
15
+ DEFAULT_HEADINGS.freeze
6
16
 
7
17
  ##
8
18
  # Current indent amount for output in characters
@@ -42,23 +52,14 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
42
52
  ##
43
53
  # Creates a new formatter that will output (mostly) \RDoc markup
44
54
 
45
- def initialize markup = nil
55
+ def initialize(markup = nil)
46
56
  super nil, markup
47
57
 
48
58
  @markup.add_regexp_handling(/\\\S/, :SUPPRESSED_CROSSREF)
49
59
  @width = 78
50
60
  init_tags
51
61
 
52
- @headings = {}
53
- @headings.default = []
54
-
55
- @headings[1] = ['= ', '']
56
- @headings[2] = ['== ', '']
57
- @headings[3] = ['=== ', '']
58
- @headings[4] = ['==== ', '']
59
- @headings[5] = ['===== ', '']
60
- @headings[6] = ['====== ', '']
61
-
62
+ @headings = DEFAULT_HEADINGS.dup
62
63
  @hard_break = "\n"
63
64
  end
64
65
 
@@ -74,14 +75,14 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
74
75
  ##
75
76
  # Adds +blank_line+ to the output
76
77
 
77
- def accept_blank_line blank_line
78
+ def accept_blank_line(blank_line)
78
79
  @res << "\n"
79
80
  end
80
81
 
81
82
  ##
82
83
  # Adds +paragraph+ to the output
83
84
 
84
- def accept_block_quote block_quote
85
+ def accept_block_quote(block_quote)
85
86
  @indent += 2
86
87
 
87
88
  block_quote.parts.each do |part|
@@ -96,7 +97,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
96
97
  ##
97
98
  # Adds +heading+ to the output
98
99
 
99
- def accept_heading heading
100
+ def accept_heading(heading)
100
101
  use_prefix or @res << ' ' * @indent
101
102
  @res << @headings[heading.level][0]
102
103
  @res << attributes(heading.text)
@@ -107,7 +108,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
107
108
  ##
108
109
  # Finishes consumption of +list+
109
110
 
110
- def accept_list_end list
111
+ def accept_list_end(list)
111
112
  @list_index.pop
112
113
  @list_type.pop
113
114
  @list_width.pop
@@ -116,7 +117,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
116
117
  ##
117
118
  # Finishes consumption of +list_item+
118
119
 
119
- def accept_list_item_end list_item
120
+ def accept_list_item_end(list_item)
120
121
  width = case @list_type.last
121
122
  when :BULLET then
122
123
  2
@@ -140,7 +141,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
140
141
  ##
141
142
  # Prepares the visitor for consuming +list_item+
142
143
 
143
- def accept_list_item_start list_item
144
+ def accept_list_item_start(list_item)
144
145
  type = @list_type.last
145
146
 
146
147
  case type
@@ -173,7 +174,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
173
174
  ##
174
175
  # Prepares the visitor for consuming +list+
175
176
 
176
- def accept_list_start list
177
+ def accept_list_start(list)
177
178
  case list.type
178
179
  when :BULLET then
179
180
  @list_index << nil
@@ -200,7 +201,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
200
201
  ##
201
202
  # Adds +paragraph+ to the output
202
203
 
203
- def accept_paragraph paragraph
204
+ def accept_paragraph(paragraph)
204
205
  text = paragraph.text @hard_break
205
206
  wrap attributes text
206
207
  end
@@ -208,7 +209,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
208
209
  ##
209
210
  # Adds +paragraph+ to the output
210
211
 
211
- def accept_indented_paragraph paragraph
212
+ def accept_indented_paragraph(paragraph)
212
213
  @indent += paragraph.indent
213
214
  text = paragraph.text @hard_break
214
215
  wrap attributes text
@@ -218,14 +219,14 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
218
219
  ##
219
220
  # Adds +raw+ to the output
220
221
 
221
- def accept_raw raw
222
+ def accept_raw(raw)
222
223
  @res << raw.parts.join("\n")
223
224
  end
224
225
 
225
226
  ##
226
227
  # Adds +rule+ to the output
227
228
 
228
- def accept_rule rule
229
+ def accept_rule(rule)
229
230
  use_prefix or @res << ' ' * @indent
230
231
  @res << '-' * (@width - @indent)
231
232
  @res << "\n"
@@ -234,7 +235,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
234
235
  ##
235
236
  # Outputs +verbatim+ indented 2 columns
236
237
 
237
- def accept_verbatim verbatim
238
+ def accept_verbatim(verbatim)
238
239
  indent = ' ' * (@indent + 2)
239
240
 
240
241
  verbatim.parts.each do |part|
@@ -248,7 +249,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
248
249
  ##
249
250
  # Adds +table+ to the output
250
251
 
251
- def accept_table header, body, aligns
252
+ def accept_table(header, body, aligns)
252
253
  widths = header.zip(*body).map do |cols|
253
254
  cols.map(&:size).max
254
255
  end
@@ -276,7 +277,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
276
277
  ##
277
278
  # Applies attribute-specific markup to +text+ using RDoc::AttributeManager
278
279
 
279
- def attributes text
280
+ def attributes(text)
280
281
  flow = @am.flow text.dup
281
282
  convert_flow flow
282
283
  end
@@ -291,7 +292,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
291
292
  ##
292
293
  # Removes preceding \\ from the suppressed crossref +target+
293
294
 
294
- def handle_regexp_SUPPRESSED_CROSSREF target
295
+ def handle_regexp_SUPPRESSED_CROSSREF(target)
295
296
  text = target.text
296
297
  text = text.sub('\\', '') unless in_tt?
297
298
  text
@@ -300,7 +301,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
300
301
  ##
301
302
  # Adds a newline to the output
302
303
 
303
- def handle_regexp_HARD_BREAK target
304
+ def handle_regexp_HARD_BREAK(target)
304
305
  "\n"
305
306
  end
306
307
 
@@ -331,7 +332,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
331
332
  ##
332
333
  # Wraps +text+ to #width
333
334
 
334
- def wrap text
335
+ def wrap(text)
335
336
  return unless text && !text.empty?
336
337
 
337
338
  text_len = @width - @indent
@@ -33,7 +33,7 @@ class RDoc::Markup::ToTableOfContents < RDoc::Markup::Formatter
33
33
  ##
34
34
  # Adds +document+ to the output, using its heading cutoff if present
35
35
 
36
- def accept_document document
36
+ def accept_document(document)
37
37
  @omit_headings_below = document.omit_headings_below
38
38
 
39
39
  super
@@ -42,7 +42,7 @@ class RDoc::Markup::ToTableOfContents < RDoc::Markup::Formatter
42
42
  ##
43
43
  # Adds +heading+ to the table of contents
44
44
 
45
- def accept_heading heading
45
+ def accept_heading(heading)
46
46
  @res << heading unless suppressed? heading
47
47
  end
48
48
 
@@ -64,7 +64,7 @@ class RDoc::Markup::ToTableOfContents < RDoc::Markup::Formatter
64
64
  ##
65
65
  # Returns true if +heading+ is below the display threshold
66
66
 
67
- def suppressed? heading
67
+ def suppressed?(heading)
68
68
  return false unless @omit_headings_below
69
69
 
70
70
  heading.level > @omit_headings_below
@@ -22,7 +22,7 @@ class RDoc::Markup::ToTest < RDoc::Markup::Formatter
22
22
  @res << convert_flow(@am.flow(paragraph.text))
23
23
  end
24
24
 
25
- def accept_raw raw
25
+ def accept_raw(raw)
26
26
  @res << raw.parts.join
27
27
  end
28
28
 
@@ -18,7 +18,7 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
18
18
  ##
19
19
  # Creates a new tt-only formatter.
20
20
 
21
- def initialize markup = nil
21
+ def initialize(markup = nil)
22
22
  super nil, markup
23
23
 
24
24
  add_tag :TT, nil, nil
@@ -27,28 +27,28 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
27
27
  ##
28
28
  # Adds tts from +block_quote+ to the output
29
29
 
30
- def accept_block_quote block_quote
30
+ def accept_block_quote(block_quote)
31
31
  tt_sections block_quote.text
32
32
  end
33
33
 
34
34
  ##
35
35
  # Pops the list type for +list+ from #list_type
36
36
 
37
- def accept_list_end list
37
+ def accept_list_end(list)
38
38
  @list_type.pop
39
39
  end
40
40
 
41
41
  ##
42
42
  # Pushes the list type for +list+ onto #list_type
43
43
 
44
- def accept_list_start list
44
+ def accept_list_start(list)
45
45
  @list_type << list.type
46
46
  end
47
47
 
48
48
  ##
49
49
  # Prepares the visitor for consuming +list_item+
50
50
 
51
- def accept_list_item_start list_item
51
+ def accept_list_item_start(list_item)
52
52
  case @list_type.last
53
53
  when :NOTE, :LABEL then
54
54
  Array(list_item.label).map do |label|
@@ -60,7 +60,7 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
60
60
  ##
61
61
  # Adds +paragraph+ to the output
62
62
 
63
- def accept_paragraph paragraph
63
+ def accept_paragraph(paragraph)
64
64
  tt_sections(paragraph.text)
65
65
  end
66
66
 
@@ -68,7 +68,7 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
68
68
  # Does nothing to +markup_item+ because it doesn't have any user-built
69
69
  # content
70
70
 
71
- def do_nothing markup_item
71
+ def do_nothing(markup_item)
72
72
  end
73
73
 
74
74
  alias accept_blank_line do_nothing # :nodoc:
@@ -81,7 +81,7 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
81
81
  ##
82
82
  # Extracts tt sections from +text+
83
83
 
84
- def tt_sections text
84
+ def tt_sections(text)
85
85
  flow = @am.flow text.dup
86
86
 
87
87
  flow.each do |item|
@@ -15,14 +15,14 @@ class RDoc::Markup::Verbatim < RDoc::Markup::Raw
15
15
  @format = nil
16
16
  end
17
17
 
18
- def == other # :nodoc:
18
+ def ==(other) # :nodoc:
19
19
  super and @format == other.format
20
20
  end
21
21
 
22
22
  ##
23
23
  # Calls #accept_verbatim on +visitor+
24
24
 
25
- def accept visitor
25
+ def accept(visitor)
26
26
  visitor.accept_verbatim self
27
27
  end
28
28
 
@@ -50,7 +50,7 @@ class RDoc::Markup::Verbatim < RDoc::Markup::Raw
50
50
  @parts = parts
51
51
  end
52
52
 
53
- def pretty_print q # :nodoc:
53
+ def pretty_print(q) # :nodoc:
54
54
  self.class.name =~ /.*::(\w{1,4})/i
55
55
 
56
56
  q.group 2, "[#{$1.downcase}: ", ']' do
data/lib/rdoc/markup.rb CHANGED
@@ -118,7 +118,7 @@ class RDoc::Markup
118
118
  ##
119
119
  # Parses +str+ into an RDoc::Markup::Document.
120
120
 
121
- def self.parse str
121
+ def self.parse(str)
122
122
  RDoc::Markup::Parser.parse str
123
123
  rescue RDoc::Markup::Parser::Error => e
124
124
  $stderr.puts <<-EOF
@@ -148,7 +148,7 @@ https://github.com/ruby/rdoc/issues
148
148
  # structure (paragraphs, lists, and so on). Invoke an event handler as we
149
149
  # identify significant chunks.
150
150
 
151
- def initialize attribute_manager = nil
151
+ def initialize(attribute_manager = nil)
152
152
  @attribute_manager = attribute_manager || RDoc::Markup::AttributeManager.new
153
153
  @output = nil
154
154
  end
@@ -185,7 +185,7 @@ https://github.com/ruby/rdoc/issues
185
185
  # We take +input+, parse it if necessary, then invoke the output +formatter+
186
186
  # using a Visitor to render the result.
187
187
 
188
- def convert input, formatter
188
+ def convert(input, formatter)
189
189
  document = case input
190
190
  when RDoc::Markup::Document then
191
191
  input