iownbey-rdoc 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/History.txt +13 -0
  2. data/Manifest.txt +61 -0
  3. data/README.txt +34 -0
  4. data/bin/rdoc +22 -0
  5. data/bin/ri +6 -0
  6. data/lib/rdoc.rb +277 -0
  7. data/lib/rdoc/code_objects.rb +776 -0
  8. data/lib/rdoc/diagram.rb +338 -0
  9. data/lib/rdoc/dot.rb +249 -0
  10. data/lib/rdoc/generator.rb +1050 -0
  11. data/lib/rdoc/generator/chm.rb +113 -0
  12. data/lib/rdoc/generator/chm/chm.rb +98 -0
  13. data/lib/rdoc/generator/html.rb +370 -0
  14. data/lib/rdoc/generator/html/hefss.rb +414 -0
  15. data/lib/rdoc/generator/html/html.rb +704 -0
  16. data/lib/rdoc/generator/html/kilmer.rb +418 -0
  17. data/lib/rdoc/generator/html/one_page_html.rb +121 -0
  18. data/lib/rdoc/generator/ri.rb +229 -0
  19. data/lib/rdoc/generator/texinfo.rb +84 -0
  20. data/lib/rdoc/generator/texinfo/class.texinfo.erb +44 -0
  21. data/lib/rdoc/generator/texinfo/file.texinfo.erb +6 -0
  22. data/lib/rdoc/generator/texinfo/method.texinfo.erb +6 -0
  23. data/lib/rdoc/generator/texinfo/texinfo.erb +28 -0
  24. data/lib/rdoc/generator/xml.rb +120 -0
  25. data/lib/rdoc/generator/xml/rdf.rb +113 -0
  26. data/lib/rdoc/generator/xml/xml.rb +111 -0
  27. data/lib/rdoc/markup.rb +473 -0
  28. data/lib/rdoc/markup/attribute_manager.rb +274 -0
  29. data/lib/rdoc/markup/formatter.rb +14 -0
  30. data/lib/rdoc/markup/fragments.rb +337 -0
  31. data/lib/rdoc/markup/inline.rb +101 -0
  32. data/lib/rdoc/markup/lines.rb +152 -0
  33. data/lib/rdoc/markup/preprocess.rb +71 -0
  34. data/lib/rdoc/markup/to_flow.rb +185 -0
  35. data/lib/rdoc/markup/to_html.rb +354 -0
  36. data/lib/rdoc/markup/to_html_crossref.rb +86 -0
  37. data/lib/rdoc/markup/to_latex.rb +328 -0
  38. data/lib/rdoc/markup/to_test.rb +50 -0
  39. data/lib/rdoc/markup/to_texinfo.rb +69 -0
  40. data/lib/rdoc/options.rb +621 -0
  41. data/lib/rdoc/parsers/parse_c.rb +775 -0
  42. data/lib/rdoc/parsers/parse_f95.rb +1841 -0
  43. data/lib/rdoc/parsers/parse_rb.rb +2584 -0
  44. data/lib/rdoc/parsers/parse_simple.rb +40 -0
  45. data/lib/rdoc/parsers/parserfactory.rb +99 -0
  46. data/lib/rdoc/rdoc.rb +277 -0
  47. data/lib/rdoc/ri.rb +4 -0
  48. data/lib/rdoc/ri/cache.rb +188 -0
  49. data/lib/rdoc/ri/descriptions.rb +150 -0
  50. data/lib/rdoc/ri/display.rb +274 -0
  51. data/lib/rdoc/ri/driver.rb +452 -0
  52. data/lib/rdoc/ri/formatter.rb +616 -0
  53. data/lib/rdoc/ri/paths.rb +102 -0
  54. data/lib/rdoc/ri/reader.rb +106 -0
  55. data/lib/rdoc/ri/util.rb +81 -0
  56. data/lib/rdoc/ri/writer.rb +68 -0
  57. data/lib/rdoc/stats.rb +25 -0
  58. data/lib/rdoc/template.rb +64 -0
  59. data/lib/rdoc/tokenstream.rb +33 -0
  60. data/test/test_rdoc_c_parser.rb +261 -0
  61. data/test/test_rdoc_info_formatting.rb +179 -0
  62. data/test/test_rdoc_info_sections.rb +93 -0
  63. data/test/test_rdoc_markup.rb +613 -0
  64. data/test/test_rdoc_markup_attribute_manager.rb +224 -0
  65. data/test/test_rdoc_ri_attribute_formatter.rb +42 -0
  66. data/test/test_rdoc_ri_default_display.rb +295 -0
  67. data/test/test_rdoc_ri_formatter.rb +318 -0
  68. data/test/test_rdoc_ri_overstrike_formatter.rb +69 -0
  69. metadata +142 -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,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iownbey-rdoc
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Davis
8
+ - Eric Hodel
9
+ - Ian Ownbey
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2008-07-04 00:00:00 -07:00
15
+ default_executable:
16
+ dependencies: []
17
+
18
+ description: RDoc makes documents out of your ruby.
19
+ email: ian@inspir.es
20
+ executables: []
21
+
22
+ extensions: []
23
+
24
+ extra_rdoc_files:
25
+ - History.txt
26
+ - Manifest.txt
27
+ - README.txt
28
+ files:
29
+ - lib/rdoc
30
+ - lib/rdoc/code_objects.rb
31
+ - lib/rdoc/diagram.rb
32
+ - lib/rdoc/dot.rb
33
+ - lib/rdoc/generator
34
+ - lib/rdoc/generator/chm
35
+ - lib/rdoc/generator/chm/chm.rb
36
+ - lib/rdoc/generator/chm.rb
37
+ - lib/rdoc/generator/html
38
+ - lib/rdoc/generator/html/hefss.rb
39
+ - lib/rdoc/generator/html/html.rb
40
+ - lib/rdoc/generator/html/kilmer.rb
41
+ - lib/rdoc/generator/html/one_page_html.rb
42
+ - lib/rdoc/generator/html.rb
43
+ - lib/rdoc/generator/ri.rb
44
+ - lib/rdoc/generator/texinfo
45
+ - lib/rdoc/generator/texinfo/class.texinfo.erb
46
+ - lib/rdoc/generator/texinfo/file.texinfo.erb
47
+ - lib/rdoc/generator/texinfo/method.texinfo.erb
48
+ - lib/rdoc/generator/texinfo/texinfo.erb
49
+ - lib/rdoc/generator/texinfo.rb
50
+ - lib/rdoc/generator/xml
51
+ - lib/rdoc/generator/xml/rdf.rb
52
+ - lib/rdoc/generator/xml/xml.rb
53
+ - lib/rdoc/generator/xml.rb
54
+ - lib/rdoc/generator.rb
55
+ - lib/rdoc/markup
56
+ - lib/rdoc/markup/attribute_manager.rb
57
+ - lib/rdoc/markup/formatter.rb
58
+ - lib/rdoc/markup/fragments.rb
59
+ - lib/rdoc/markup/inline.rb
60
+ - lib/rdoc/markup/lines.rb
61
+ - lib/rdoc/markup/preprocess.rb
62
+ - lib/rdoc/markup/to_flow.rb
63
+ - lib/rdoc/markup/to_html.rb
64
+ - lib/rdoc/markup/to_html_crossref.rb
65
+ - lib/rdoc/markup/to_latex.rb
66
+ - lib/rdoc/markup/to_test.rb
67
+ - lib/rdoc/markup/to_texinfo.rb
68
+ - lib/rdoc/markup.rb
69
+ - lib/rdoc/options.rb
70
+ - lib/rdoc/parsers
71
+ - lib/rdoc/parsers/parse_c.rb
72
+ - lib/rdoc/parsers/parse_f95.rb
73
+ - lib/rdoc/parsers/parse_rb.rb
74
+ - lib/rdoc/parsers/parse_simple.rb
75
+ - lib/rdoc/parsers/parserfactory.rb
76
+ - lib/rdoc/rdoc.rb
77
+ - lib/rdoc/ri
78
+ - lib/rdoc/ri/cache.rb
79
+ - lib/rdoc/ri/descriptions.rb
80
+ - lib/rdoc/ri/display.rb
81
+ - lib/rdoc/ri/driver.rb
82
+ - lib/rdoc/ri/formatter.rb
83
+ - lib/rdoc/ri/paths.rb
84
+ - lib/rdoc/ri/reader.rb
85
+ - lib/rdoc/ri/util.rb
86
+ - lib/rdoc/ri/writer.rb
87
+ - lib/rdoc/ri.rb
88
+ - lib/rdoc/stats.rb
89
+ - lib/rdoc/template.rb
90
+ - lib/rdoc/tokenstream.rb
91
+ - lib/rdoc.rb
92
+ - bin/rdoc
93
+ - bin/ri
94
+ - test/test_rdoc_c_parser.rb
95
+ - test/test_rdoc_info_formatting.rb
96
+ - test/test_rdoc_info_sections.rb
97
+ - test/test_rdoc_markup.rb
98
+ - test/test_rdoc_markup_attribute_manager.rb
99
+ - test/test_rdoc_ri_attribute_formatter.rb
100
+ - test/test_rdoc_ri_default_display.rb
101
+ - test/test_rdoc_ri_formatter.rb
102
+ - test/test_rdoc_ri_overstrike_formatter.rb
103
+ - History.txt
104
+ - Manifest.txt
105
+ - README.txt
106
+ has_rdoc: true
107
+ homepage: http://github.com/iownbey/rdoc/
108
+ post_install_message:
109
+ rdoc_options:
110
+ - --main
111
+ - README.txt
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: "0"
119
+ version:
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: "0"
125
+ version:
126
+ requirements: []
127
+
128
+ rubyforge_project:
129
+ rubygems_version: 1.2.0
130
+ signing_key:
131
+ specification_version: 2
132
+ summary: Documentation library for ruby
133
+ test_files:
134
+ - test/test_rdoc_c_parser.rb
135
+ - test/test_rdoc_info_formatting.rb
136
+ - test/test_rdoc_info_sections.rb
137
+ - test/test_rdoc_markup.rb
138
+ - test/test_rdoc_markup_attribute_manager.rb
139
+ - test/test_rdoc_ri_attribute_formatter.rb
140
+ - test/test_rdoc_ri_default_display.rb
141
+ - test/test_rdoc_ri_formatter.rb
142
+ - test/test_rdoc_ri_overstrike_formatter.rb