rdoc 2.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (62) hide show
  1. data/History.txt +13 -0
  2. data/Manifest.txt +61 -0
  3. data/README.txt +34 -0
  4. data/Rakefile +10 -0
  5. data/bin/rdoc +22 -0
  6. data/bin/ri +6 -0
  7. data/lib/rdoc.rb +277 -0
  8. data/lib/rdoc/code_objects.rb +776 -0
  9. data/lib/rdoc/diagram.rb +338 -0
  10. data/lib/rdoc/dot.rb +249 -0
  11. data/lib/rdoc/generator.rb +1048 -0
  12. data/lib/rdoc/generator/chm.rb +113 -0
  13. data/lib/rdoc/generator/chm/chm.rb +98 -0
  14. data/lib/rdoc/generator/html.rb +370 -0
  15. data/lib/rdoc/generator/html/hefss.rb +414 -0
  16. data/lib/rdoc/generator/html/html.rb +704 -0
  17. data/lib/rdoc/generator/html/kilmer.rb +418 -0
  18. data/lib/rdoc/generator/html/one_page_html.rb +121 -0
  19. data/lib/rdoc/generator/ri.rb +229 -0
  20. data/lib/rdoc/generator/xml.rb +120 -0
  21. data/lib/rdoc/generator/xml/rdf.rb +113 -0
  22. data/lib/rdoc/generator/xml/xml.rb +111 -0
  23. data/lib/rdoc/markup.rb +473 -0
  24. data/lib/rdoc/markup/attribute_manager.rb +274 -0
  25. data/lib/rdoc/markup/formatter.rb +14 -0
  26. data/lib/rdoc/markup/fragments.rb +337 -0
  27. data/lib/rdoc/markup/inline.rb +101 -0
  28. data/lib/rdoc/markup/lines.rb +152 -0
  29. data/lib/rdoc/markup/preprocess.rb +71 -0
  30. data/lib/rdoc/markup/to_flow.rb +185 -0
  31. data/lib/rdoc/markup/to_html.rb +353 -0
  32. data/lib/rdoc/markup/to_html_crossref.rb +86 -0
  33. data/lib/rdoc/markup/to_latex.rb +328 -0
  34. data/lib/rdoc/markup/to_test.rb +50 -0
  35. data/lib/rdoc/options.rb +616 -0
  36. data/lib/rdoc/parsers/parse_c.rb +775 -0
  37. data/lib/rdoc/parsers/parse_f95.rb +1841 -0
  38. data/lib/rdoc/parsers/parse_rb.rb +2584 -0
  39. data/lib/rdoc/parsers/parse_simple.rb +40 -0
  40. data/lib/rdoc/parsers/parserfactory.rb +99 -0
  41. data/lib/rdoc/rdoc.rb +277 -0
  42. data/lib/rdoc/ri.rb +4 -0
  43. data/lib/rdoc/ri/cache.rb +188 -0
  44. data/lib/rdoc/ri/descriptions.rb +150 -0
  45. data/lib/rdoc/ri/display.rb +274 -0
  46. data/lib/rdoc/ri/driver.rb +452 -0
  47. data/lib/rdoc/ri/formatter.rb +616 -0
  48. data/lib/rdoc/ri/paths.rb +102 -0
  49. data/lib/rdoc/ri/reader.rb +106 -0
  50. data/lib/rdoc/ri/util.rb +81 -0
  51. data/lib/rdoc/ri/writer.rb +68 -0
  52. data/lib/rdoc/stats.rb +25 -0
  53. data/lib/rdoc/template.rb +64 -0
  54. data/lib/rdoc/tokenstream.rb +33 -0
  55. data/test/test_rdoc_c_parser.rb +261 -0
  56. data/test/test_rdoc_markup.rb +613 -0
  57. data/test/test_rdoc_markup_attribute_manager.rb +224 -0
  58. data/test/test_rdoc_ri_attribute_formatter.rb +42 -0
  59. data/test/test_rdoc_ri_default_display.rb +295 -0
  60. data/test/test_rdoc_ri_formatter.rb +318 -0
  61. data/test/test_rdoc_ri_overstrike_formatter.rb +69 -0
  62. metadata +134 -0
@@ -0,0 +1,318 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require 'rdoc/ri/formatter'
4
+ require 'rdoc/markup/to_flow'
5
+
6
+ class TestRDocRIFormatter < Test::Unit::TestCase
7
+
8
+ def setup
9
+ @output = StringIO.new
10
+ @width = 78
11
+ @indent = ' '
12
+
13
+ @f = RDoc::RI::Formatter.new @output, @width, @indent
14
+ @markup = RDoc::Markup.new
15
+ @flow = RDoc::Markup::ToFlow.new
16
+ end
17
+
18
+ def test_blankline
19
+ @f.blankline
20
+
21
+ assert_equal "\n", @output.string
22
+ end
23
+
24
+ def test_bold_print
25
+ @f.bold_print 'a b c'
26
+
27
+ assert_equal 'a b c', @output.string
28
+ end
29
+
30
+ def test_break_to_newline
31
+ @f.break_to_newline
32
+
33
+ assert_equal '', @output.string
34
+ end
35
+
36
+ def test_conv_html
37
+ assert_equal '> < " &', @f.conv_html('&gt; &lt; &quot; &amp;')
38
+ end
39
+
40
+ def test_conv_markup
41
+ text = '<tt>a</tt> <code>b</code> <b>c</b> <em>d</em>'
42
+
43
+ expected = '+a+ +b+ *c* _d_'
44
+
45
+ assert_equal expected, @f.conv_markup(text)
46
+ end
47
+
48
+ def test_display_flow
49
+ flow = [
50
+ RDoc::Markup::Flow::H.new(1, 'heading'),
51
+ RDoc::Markup::Flow::P.new('paragraph'),
52
+ ]
53
+
54
+ @f.display_flow flow
55
+
56
+ assert_equal "\nHEADING\n=======\n\n paragraph\n\n", @output.string
57
+ end
58
+
59
+ def test_display_flow_item_h
60
+ item = RDoc::Markup::Flow::H.new 1, 'heading'
61
+
62
+ @f.display_flow_item item
63
+
64
+ assert_equal "\nHEADING\n=======\n\n", @output.string
65
+ end
66
+
67
+ def test_display_flow_item_li
68
+ item = RDoc::Markup::Flow::LI.new nil, 'paragraph'
69
+
70
+ @f.display_flow_item item
71
+
72
+ assert_equal " paragraph\n\n", @output.string
73
+ end
74
+
75
+ def test_display_flow_item_list
76
+ item = RDoc::Markup::Flow::LIST.new :NUMBER
77
+
78
+ @f.display_flow_item item
79
+
80
+ assert_equal "", @output.string
81
+ end
82
+
83
+ def test_display_flow_item_p
84
+ item = RDoc::Markup::Flow::P.new 'paragraph'
85
+
86
+ @f.display_flow_item item
87
+
88
+ assert_equal " paragraph\n\n", @output.string
89
+ end
90
+
91
+ def test_display_flow_item_rule
92
+ item = RDoc::Markup::Flow::RULE.new 1
93
+
94
+ @f.display_flow_item item
95
+
96
+ assert_equal "#{'-' * 78}\n", @output.string
97
+ end
98
+
99
+ def test_display_flow_item_unknown
100
+ e = assert_raise RDoc::Error do
101
+ @f.display_flow_item Object.new
102
+ end
103
+
104
+ assert_equal "Unknown flow element: Object", e.message
105
+ end
106
+
107
+ def test_display_flow_item_verb
108
+ item = RDoc::Markup::Flow::VERB.new 'a b c'
109
+
110
+ @f.display_flow_item item
111
+
112
+ assert_equal " a b c\n\n", @output.string
113
+ end
114
+
115
+ def test_display_heading_1
116
+ @f.display_heading 'heading', 1, ' '
117
+
118
+ assert_equal "\nHEADING\n=======\n\n", @output.string
119
+ end
120
+
121
+ def test_display_heading_2
122
+ @f.display_heading 'heading', 2, ' '
123
+
124
+ assert_equal "\nheading\n-------\n\n", @output.string
125
+ end
126
+
127
+ def test_display_heading_3
128
+ @f.display_heading 'heading', 3, ' '
129
+
130
+ assert_equal " heading\n\n", @output.string
131
+ end
132
+
133
+ def test_display_list
134
+ list = RDoc::Markup::Flow::LIST.new :NUMBER
135
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
136
+ list << RDoc::Markup::Flow::LI.new(nil, 'd e f')
137
+
138
+ @f.display_list list
139
+
140
+ assert_equal " 1. a b c\n\n 2. d e f\n\n", @output.string
141
+ end
142
+
143
+ def test_display_list_bullet
144
+ list = RDoc::Markup::Flow::LIST.new :BULLET
145
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
146
+
147
+ @f.display_list list
148
+
149
+ assert_equal " * a b c\n\n", @output.string
150
+ end
151
+
152
+ def test_display_list_labeled
153
+ list = RDoc::Markup::Flow::LIST.new :LABELED
154
+ list << RDoc::Markup::Flow::LI.new('label', 'a b c')
155
+
156
+ @f.display_list list
157
+
158
+ assert_equal " label a b c\n\n", @output.string
159
+ end
160
+
161
+ def test_display_list_lower_alpha
162
+ list = RDoc::Markup::Flow::LIST.new :LOWERALPHA
163
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
164
+
165
+ @f.display_list list
166
+
167
+ assert_equal " a. a b c\n\n", @output.string
168
+ end
169
+
170
+ def test_display_list_note
171
+ list = RDoc::Markup::Flow::LIST.new :NOTE
172
+ list << RDoc::Markup::Flow::LI.new('note:', 'a b c')
173
+
174
+ @f.display_list list
175
+
176
+ assert_equal " note: a b c\n\n", @output.string
177
+ end
178
+
179
+ def test_display_list_number
180
+ list = RDoc::Markup::Flow::LIST.new :NUMBER
181
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
182
+
183
+ @f.display_list list
184
+
185
+ assert_equal " 1. a b c\n\n", @output.string
186
+ end
187
+
188
+ def test_display_list_unknown
189
+ list = RDoc::Markup::Flow::LIST.new :UNKNOWN
190
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
191
+
192
+ e = assert_raise ArgumentError do
193
+ @f.display_list list
194
+ end
195
+
196
+ assert_equal 'unknown list type UNKNOWN', e.message
197
+ end
198
+
199
+ def test_display_list_upper_alpha
200
+ list = RDoc::Markup::Flow::LIST.new :UPPERALPHA
201
+ list << RDoc::Markup::Flow::LI.new(nil, 'a b c')
202
+
203
+ @f.display_list list
204
+
205
+ assert_equal " A. a b c\n\n", @output.string
206
+ end
207
+
208
+ def test_display_verbatim_flow_item
209
+ verbatim = RDoc::Markup::Flow::VERB.new "a b c\nd e f"
210
+
211
+ @f.display_verbatim_flow_item verbatim
212
+
213
+ assert_equal " a b c\n d e f\n\n", @output.string
214
+ end
215
+
216
+ def test_display_verbatim_flow_item_bold
217
+ verbatim = RDoc::Markup::Flow::VERB.new "*a* b c"
218
+
219
+ @f.display_verbatim_flow_item verbatim
220
+
221
+ assert_equal " *a* b c\n\n", @output.string
222
+ end
223
+
224
+ def test_draw_line
225
+ @f.draw_line
226
+
227
+ expected = '-' * @width + "\n"
228
+ assert_equal expected, @output.string
229
+ end
230
+
231
+ def test_draw_line_label
232
+ @f.draw_line 'label'
233
+
234
+ expected = '-' * (@width - 6) + " label\n"
235
+ assert_equal expected, @output.string
236
+ end
237
+
238
+ def test_draw_line_label_long
239
+ @f.draw_line 'a' * @width
240
+
241
+ expected = '-' * @width + "\n" + ('a' * @width) + "\n"
242
+ assert_equal expected, @output.string
243
+ end
244
+
245
+ def test_raw_print_line
246
+ @f.raw_print_line 'a b c'
247
+
248
+ assert_equal "a b c\n", @output.string
249
+ end
250
+
251
+ def test_strip_attributes_b
252
+ text = @f.strip_attributes 'hello <b>world</b>'
253
+
254
+ expected = 'hello world'
255
+
256
+ assert_equal expected, text
257
+ end
258
+
259
+ def test_strip_attributes_code
260
+ text = @f.strip_attributes 'hello <code>world</code>'
261
+
262
+ expected = 'hello world'
263
+
264
+ assert_equal expected, text
265
+ end
266
+
267
+ def test_strip_attributes_em
268
+ text = @f.strip_attributes 'hello <em>world</em>'
269
+
270
+ expected = 'hello world'
271
+
272
+ assert_equal expected, text
273
+ end
274
+
275
+ def test_strip_attributes_i
276
+ text = @f.strip_attributes 'hello <i>world</i>'
277
+
278
+ expected = 'hello world'
279
+
280
+ assert_equal expected, text
281
+ end
282
+
283
+ def test_strip_attributes_tt
284
+ text = @f.strip_attributes 'hello <tt>world</tt>'
285
+
286
+ expected = 'hello world'
287
+
288
+ assert_equal expected, text
289
+ end
290
+
291
+ def test_wrap_empty
292
+ @f.wrap ''
293
+ assert_equal '', @output.string
294
+ end
295
+
296
+ def test_wrap_long
297
+ @f.wrap 'a ' * (@width / 2)
298
+ assert_equal " a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a\n a \n",
299
+ @output.string
300
+ end
301
+
302
+ def test_wrap_markup
303
+ @f.wrap 'a <tt>b</tt> c'
304
+ assert_equal " a +b+ c\n", @output.string
305
+ end
306
+
307
+ def test_wrap_nil
308
+ @f.wrap nil
309
+ assert_equal '', @output.string
310
+ end
311
+
312
+ def test_wrap_short
313
+ @f.wrap 'a b c'
314
+ assert_equal " a b c\n", @output.string
315
+ end
316
+
317
+ end
318
+
@@ -0,0 +1,69 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require 'rdoc/ri/formatter'
4
+ require 'rdoc/markup/fragments'
5
+ require 'rdoc/markup/to_flow'
6
+
7
+ class TestRDocRIOverstrikeFormatter < Test::Unit::TestCase
8
+
9
+ def setup
10
+ @output = StringIO.new
11
+ @width = 78
12
+ @indent = ' '
13
+
14
+ @f = RDoc::RI::OverstrikeFormatter.new @output, @width, @indent
15
+ @markup = RDoc::Markup.new
16
+ @flow = RDoc::Markup::ToFlow.new
17
+
18
+ @af = RDoc::RI::AttributeFormatter
19
+ end
20
+
21
+ def test_display_verbatim_flow_item_bold
22
+ verbatim = RDoc::Markup::Flow::VERB.new "*a* b c"
23
+
24
+ @f.display_verbatim_flow_item verbatim
25
+
26
+ assert_equal " *a* b c\n\n", @output.string
27
+ end
28
+
29
+ def test_write_attribute_text_bold
30
+ line = [RDoc::RI::AttributeFormatter::AttrChar.new('b', @af::BOLD)]
31
+
32
+ @f.write_attribute_text ' ', line
33
+
34
+ assert_equal " b\bb\n", @output.string
35
+ end
36
+
37
+ def test_write_attribute_text_bold_italic
38
+ attr = @af::BOLD | @af::ITALIC
39
+ line = [RDoc::RI::AttributeFormatter::AttrChar.new('d', attr)]
40
+
41
+ @f.write_attribute_text ' ', line
42
+
43
+ assert_equal " _\bd\bd\n", @output.string
44
+ end
45
+
46
+ def test_write_attribute_text_code
47
+ line = [RDoc::RI::AttributeFormatter::AttrChar.new('c', @af::CODE)]
48
+
49
+ @f.write_attribute_text ' ', line
50
+
51
+ assert_equal " _\bc\n", @output.string
52
+ end
53
+
54
+ def test_write_attribute_text_italic
55
+ line = [RDoc::RI::AttributeFormatter::AttrChar.new('a', @af::ITALIC)]
56
+
57
+ @f.write_attribute_text ' ', line
58
+
59
+ assert_equal " _\ba\n", @output.string
60
+ end
61
+
62
+ def test_bold_print
63
+ @f.bold_print 'a b c'
64
+
65
+ assert_equal "a\ba \b b\bb \b c\bc", @output.string
66
+ end
67
+
68
+ end
69
+
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rdoc
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Eric Hodel
8
+ - Dave Thomas
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2008-04-10 00:00:00 -07:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: hoe
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.5.1
24
+ version:
25
+ description: RDoc is an application that produces documentation for one or more Ruby source files. RDoc includes the `rdoc` and `ri` tools for generating and displaying online documentation. At this point in time, RDoc 2.x is a work in progress and may incur further API changes beyond what has been made to the RDoc 1.0.1. Command-line tools are largely unaffected, but internal APIs may shift rapidly.
26
+ email:
27
+ - drbrain@segment7.net
28
+ - ""
29
+ executables:
30
+ - rdoc
31
+ - ri
32
+ extensions: []
33
+
34
+ extra_rdoc_files:
35
+ - History.txt
36
+ - Manifest.txt
37
+ - README.txt
38
+ files:
39
+ - History.txt
40
+ - Manifest.txt
41
+ - README.txt
42
+ - Rakefile
43
+ - bin/rdoc
44
+ - bin/ri
45
+ - lib/rdoc.rb
46
+ - lib/rdoc/code_objects.rb
47
+ - lib/rdoc/diagram.rb
48
+ - lib/rdoc/dot.rb
49
+ - lib/rdoc/generator.rb
50
+ - lib/rdoc/generator/chm.rb
51
+ - lib/rdoc/generator/chm/chm.rb
52
+ - lib/rdoc/generator/html.rb
53
+ - lib/rdoc/generator/html/hefss.rb
54
+ - lib/rdoc/generator/html/html.rb
55
+ - lib/rdoc/generator/html/kilmer.rb
56
+ - lib/rdoc/generator/html/one_page_html.rb
57
+ - lib/rdoc/generator/ri.rb
58
+ - lib/rdoc/generator/xml.rb
59
+ - lib/rdoc/generator/xml/rdf.rb
60
+ - lib/rdoc/generator/xml/xml.rb
61
+ - lib/rdoc/markup.rb
62
+ - lib/rdoc/markup/attribute_manager.rb
63
+ - lib/rdoc/markup/formatter.rb
64
+ - lib/rdoc/markup/fragments.rb
65
+ - lib/rdoc/markup/inline.rb
66
+ - lib/rdoc/markup/lines.rb
67
+ - lib/rdoc/markup/preprocess.rb
68
+ - lib/rdoc/markup/to_flow.rb
69
+ - lib/rdoc/markup/to_html.rb
70
+ - lib/rdoc/markup/to_html_crossref.rb
71
+ - lib/rdoc/markup/to_latex.rb
72
+ - lib/rdoc/markup/to_test.rb
73
+ - lib/rdoc/options.rb
74
+ - lib/rdoc/parsers/parse_c.rb
75
+ - lib/rdoc/parsers/parse_f95.rb
76
+ - lib/rdoc/parsers/parse_rb.rb
77
+ - lib/rdoc/parsers/parse_simple.rb
78
+ - lib/rdoc/parsers/parserfactory.rb
79
+ - lib/rdoc/rdoc.rb
80
+ - lib/rdoc/ri.rb
81
+ - lib/rdoc/ri/cache.rb
82
+ - lib/rdoc/ri/descriptions.rb
83
+ - lib/rdoc/ri/display.rb
84
+ - lib/rdoc/ri/driver.rb
85
+ - lib/rdoc/ri/formatter.rb
86
+ - lib/rdoc/ri/paths.rb
87
+ - lib/rdoc/ri/reader.rb
88
+ - lib/rdoc/ri/util.rb
89
+ - lib/rdoc/ri/writer.rb
90
+ - lib/rdoc/stats.rb
91
+ - lib/rdoc/template.rb
92
+ - lib/rdoc/tokenstream.rb
93
+ - test/test_rdoc_c_parser.rb
94
+ - test/test_rdoc_markup.rb
95
+ - test/test_rdoc_markup_attribute_manager.rb
96
+ - test/test_rdoc_ri_attribute_formatter.rb
97
+ - test/test_rdoc_ri_default_display.rb
98
+ - test/test_rdoc_ri_formatter.rb
99
+ - test/test_rdoc_ri_overstrike_formatter.rb
100
+ has_rdoc: true
101
+ homepage: http://rubyforge.org/projects/rdoc/
102
+ post_install_message:
103
+ rdoc_options:
104
+ - --main
105
+ - README.txt
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: "0"
113
+ version:
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: "0"
119
+ version:
120
+ requirements: []
121
+
122
+ rubyforge_project: rdoc
123
+ rubygems_version: 1.1.0
124
+ signing_key:
125
+ specification_version: 2
126
+ summary: RDoc is an application that produces documentation for one or more Ruby source files
127
+ test_files:
128
+ - test/test_rdoc_c_parser.rb
129
+ - test/test_rdoc_markup.rb
130
+ - test/test_rdoc_markup_attribute_manager.rb
131
+ - test/test_rdoc_ri_attribute_formatter.rb
132
+ - test/test_rdoc_ri_default_display.rb
133
+ - test/test_rdoc_ri_formatter.rb
134
+ - test/test_rdoc_ri_overstrike_formatter.rb