rdoc 2.2.1 → 2.3.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 (95) hide show
  1. data.tar.gz.sig +2 -0
  2. data/.document +4 -0
  3. data/History.txt +35 -0
  4. data/Manifest.txt +36 -15
  5. data/README.txt +11 -27
  6. data/Rakefile +3 -0
  7. data/lib/rdoc.rb +1 -1
  8. data/lib/rdoc/cache.rb +32 -0
  9. data/lib/rdoc/code_objects.rb +121 -59
  10. data/lib/rdoc/generator.rb +196 -133
  11. data/lib/rdoc/generator/darkfish.rb +471 -0
  12. data/lib/rdoc/generator/html.rb +71 -60
  13. data/lib/rdoc/generator/html/html.rb +115 -115
  14. data/lib/rdoc/generator/html/one_page_html.rb +56 -56
  15. data/lib/rdoc/generator/ri.rb +2 -0
  16. data/lib/rdoc/generator/template/darkfish/.document +0 -0
  17. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +302 -0
  18. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +114 -0
  19. data/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  20. data/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  21. data/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  22. data/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  23. data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  24. data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  25. data/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  26. data/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  27. data/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  28. data/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  29. data/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  30. data/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  31. data/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  32. data/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  33. data/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  34. data/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  35. data/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  36. data/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  37. data/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  38. data/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  39. data/lib/rdoc/generator/template/darkfish/index.rhtml +57 -0
  40. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +116 -0
  41. data/lib/rdoc/generator/template/darkfish/js/jquery.js +32 -0
  42. data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +114 -0
  43. data/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +10 -0
  44. data/lib/rdoc/generator/template/darkfish/rdoc.css +696 -0
  45. data/lib/rdoc/generator/xml.rb +19 -12
  46. data/lib/rdoc/generator/xml/rdf.rb +50 -50
  47. data/lib/rdoc/generator/xml/xml.rb +58 -58
  48. data/lib/rdoc/known_classes.rb +0 -1
  49. data/lib/rdoc/markup/preprocess.rb +4 -3
  50. data/lib/rdoc/markup/to_html.rb +4 -1
  51. data/lib/rdoc/markup/to_html_crossref.rb +28 -31
  52. data/lib/rdoc/options.rb +25 -20
  53. data/lib/rdoc/parser.rb +10 -2
  54. data/lib/rdoc/parser/c.rb +38 -29
  55. data/lib/rdoc/parser/f95.rb +32 -32
  56. data/lib/rdoc/parser/ruby.rb +5 -2
  57. data/lib/rdoc/parser/simple.rb +1 -0
  58. data/lib/rdoc/rdoc.rb +99 -47
  59. data/lib/rdoc/ri/cache.rb +6 -6
  60. data/lib/rdoc/ri/display.rb +22 -75
  61. data/lib/rdoc/ri/driver.rb +237 -78
  62. data/lib/rdoc/stats.rb +91 -28
  63. data/lib/rdoc/template.rb +6 -2
  64. data/test/test.ja.rdoc +8 -0
  65. data/test/test.ja.txt +8 -0
  66. data/test/test_attribute_manager.rb +9 -6
  67. data/test/test_rdoc_markup.rb +4 -2
  68. data/test/test_rdoc_markup_attribute_manager.rb +13 -3
  69. data/test/test_rdoc_markup_to_html.rb +18 -2
  70. data/test/test_rdoc_markup_to_html_crossref.rb +186 -249
  71. data/test/test_rdoc_parser.rb +17 -1
  72. data/test/test_rdoc_parser_c.rb +65 -10
  73. data/test/test_rdoc_parser_perl.rb +4 -2
  74. data/test/test_rdoc_parser_ruby.rb +6 -4
  75. data/test/test_rdoc_ri_attribute_formatter.rb +4 -2
  76. data/test/test_rdoc_ri_default_display.rb +8 -4
  77. data/test/test_rdoc_ri_driver.rb +4 -2
  78. data/test/test_rdoc_ri_formatter.rb +6 -4
  79. data/test/test_rdoc_ri_overstrike_formatter.rb +4 -2
  80. metadata +84 -33
  81. metadata.gz.sig +0 -0
  82. data/lib/rdoc/generator/chm.rb +0 -113
  83. data/lib/rdoc/generator/chm/chm.rb +0 -100
  84. data/lib/rdoc/generator/html/frameless.rb +0 -92
  85. data/lib/rdoc/generator/html/hefss.rb +0 -150
  86. data/lib/rdoc/generator/html/kilmer.rb +0 -151
  87. data/lib/rdoc/generator/html/kilmerfactory.rb +0 -427
  88. data/lib/rdoc/generator/texinfo.rb +0 -81
  89. data/lib/rdoc/generator/texinfo/class.texinfo.erb +0 -44
  90. data/lib/rdoc/generator/texinfo/file.texinfo.erb +0 -6
  91. data/lib/rdoc/generator/texinfo/method.texinfo.erb +0 -6
  92. data/lib/rdoc/generator/texinfo/texinfo.erb +0 -28
  93. data/test/rdoc_markup_to_html_crossref_reference.rb +0 -31
  94. data/test/test_rdoc_info_formatting.rb +0 -175
  95. data/test/test_rdoc_info_sections.rb +0 -136
@@ -1,81 +0,0 @@
1
- require 'rdoc/rdoc'
2
- require 'rdoc/generator'
3
- require 'rdoc/markup/to_texinfo'
4
-
5
- module RDoc
6
- module Generator
7
- # This generates Texinfo files for viewing with GNU Info or Emacs
8
- # from RDoc extracted from Ruby source files.
9
- class TEXINFO
10
- # What should the .info file be named by default?
11
- DEFAULT_INFO_FILENAME = 'rdoc.info'
12
-
13
- include Generator::MarkUp
14
-
15
- # Accept some options
16
- def initialize(options)
17
- @options = options
18
- @options.inline_source = true
19
- @options.op_name ||= 'rdoc.texinfo'
20
- @options.formatter = ::RDoc::Markup::ToTexInfo.new
21
- end
22
-
23
- # Generate the +texinfo+ files
24
- def generate(toplevels)
25
- @toplevels = toplevels
26
- @files, @classes = ::RDoc::Generator::Context.build_indices(@toplevels,
27
- @options)
28
-
29
- (@files + @classes).each { |x| x.value_hash }
30
-
31
- open(@options.op_name, 'w') do |f|
32
- f.puts TexinfoTemplate.new('files' => @files,
33
- 'classes' => @classes,
34
- 'filename' => @options.op_name.gsub(/texinfo/, 'info'),
35
- 'title' => @options.title).render
36
- end
37
- # TODO: create info files and install?
38
- end
39
-
40
- class << self
41
- # Factory? We don't need no stinkin' factory!
42
- alias_method :for, :new
43
- end
44
- end
45
-
46
- # Basically just a wrapper around ERB.
47
- # Should probably use RDoc::TemplatePage instead
48
- class TexinfoTemplate
49
- BASE_DIR = ::File.expand_path(::File.dirname(__FILE__)) # have to calculate this when the file's loaded.
50
-
51
- def initialize(values, file = 'texinfo.erb')
52
- @v, @file = [values, file]
53
- end
54
-
55
- def template
56
- ::File.read(::File.join(BASE_DIR, 'texinfo', @file))
57
- end
58
-
59
- # Go!
60
- def render
61
- ERB.new(template).result binding
62
- end
63
-
64
- def href(location, text)
65
- text # TODO: how does texinfo do hyperlinks?
66
- end
67
-
68
- def target(name, text)
69
- text # TODO: how do hyperlink targets work?
70
- end
71
-
72
- # TODO: this is probably implemented elsewhere?
73
- def method_prefix(section)
74
- { 'Class' => '.',
75
- 'Module' => '::',
76
- 'Instance' => '#',
77
- }[section['category']]
78
- end
79
- end
80
- end
81
- end
@@ -1,44 +0,0 @@
1
- @node <%= @v['class']['full_name'].gsub(/::/, '-') %>
2
- @chapter <%= @v['class']["classmod"] %> <%= @v['class']['full_name'] %>
3
-
4
- <% if @v['class']["parent"] and @v['class']['par_url'] %>
5
- Inherits <%= href @v['class']["par_url"], @v['class']["parent"] %><% end %>
6
-
7
- <%= @v['class']["description"] %>
8
-
9
- <% if @v['class']["includes"] %>
10
- Includes
11
- <% @v['class']["includes"].each do |include| %>
12
- * <%= href include["aref"], include["name"] %>
13
- <% end # @v['class']["includes"] %>
14
- <% end %>
15
-
16
- <% if @v['class']["sections"] %>
17
- <% @v['class']["sections"].each do |section| %>
18
- <% if section["attributes"] %>
19
- Attributes
20
- <% section["attributes"].each do |attributes| %>
21
- * <%= attributes["name"] %> <%= attributes["rw"] %> <%= attributes["a_desc"] %>
22
- <% end # section["attributes"] %>
23
- <% end %>
24
- <% end %>
25
-
26
- <% @v['class']["sections"].each do |section| %>
27
- <% if section["method_list"] %>
28
- Methods
29
- @menu
30
- <% section["method_list"].each_with_index do |method_list, i| %>
31
- <%= i %>
32
- <% (method_list["methods"] || []).each do |method| %>
33
- * <%= @v['class']['full_name'].gsub(/::/, '-') %><%= method_prefix method_list %><%= method['name'] %>::<% end %>
34
- <% end %>
35
- @end menu
36
-
37
- <% section["method_list"].each do |method_list| %>
38
- <% (method_list["methods"] || []).uniq.each do |method| %>
39
- <%= TexinfoTemplate.new(@v.merge({'method' => method, 'list' => method_list}),
40
- 'method.texinfo.erb').render %><% end %>
41
- <% end %>
42
- <% end # if section["method_list"] %>
43
- <% end # @v['class']["sections"] %>
44
- <% end %>
@@ -1,6 +0,0 @@
1
- <% if false %>
2
- <h2>File: <%= @v['file']["short_name"] %></h2>
3
- Path: <%= @v['file']["full_path"] %>
4
-
5
- <%= TexinfoTemplate.new(@v, 'content.texinfo.erb').render %>
6
- <% end %>
@@ -1,6 +0,0 @@
1
- @node <%= @v['class']['full_name'].gsub(/::/, '-') %><%= method_prefix @v['list'] %><%= @v['method']['name'] %>
2
- @section <%= @v['class']["classmod"] %> <%= @v['class']['full_name'] %><%= method_prefix @v['list'] %><%= @v['method']['name'] %>
3
- <%= @v['method']["type"] %> <%= @v['method']["category"] %> method:
4
- <%= target @v['method']["aref"], @v['method']['callseq'] ||
5
- @v['method']["name"] + @v['method']["params"] %>
6
- <%= @v['method']["m_desc"] %>
@@ -1,28 +0,0 @@
1
- \input texinfo @c -*-texinfo-*-
2
- @c %**start of header
3
- @setfilename <%= @v['filename'] %>
4
- @settitle <%= @v['title'] %>
5
- @c %**end of header
6
-
7
- @contents @c TODO: whitespace is a mess... =\
8
-
9
- @ifnottex
10
- @node Top
11
-
12
- @top <%= @v['title'] %>
13
- @end ifnottex
14
-
15
- <% if @f = @v['files'].detect { |f| f.name =~ /Readme/i } %>
16
- <%= @f.values['description'] %><% end %>
17
-
18
- @menu
19
- <% @v['classes'].each do |klass| %>
20
- * <%= klass.name.gsub(/::/, '-') %>::<% end %>
21
- @c TODO: add files
22
- @end menu
23
-
24
- <% (@v['classes'] || []).each_with_index do |klass, i| %>
25
- <%= TexinfoTemplate.new(@v.merge('class' => klass.values),
26
- 'class.texinfo.erb').render %><% end %>
27
-
28
- @bye
@@ -1,31 +0,0 @@
1
- #
2
- # This file is parsed by test_rdoc_markup_to_html_crossref.rb
3
- # during its tests.
4
- #
5
- class Ref_Class1
6
- end
7
-
8
- class Ref_Class2
9
- class Ref_Class3
10
- def method
11
- end
12
-
13
- class Helper1
14
- def method?
15
- end
16
- end
17
- end
18
- end
19
-
20
- class Ref_Class3
21
- class Helper1
22
- end
23
-
24
- class Helper2
25
- end
26
- end
27
-
28
- class Ref_Class4
29
- class Ref_Class4
30
- end
31
- end
@@ -1,175 +0,0 @@
1
- require 'fileutils'
2
- require 'tmpdir'
3
- require 'test/unit'
4
-
5
- require 'rdoc/generator/texinfo'
6
-
7
- # From chapter 18 of the Pickaxe 3rd ed. and the TexInfo manual.
8
- class TestRDocInfoFormatting < Test::Unit::TestCase
9
- def setup
10
- @output_dir = File.join Dir.tmpdir, "test_rdoc_info_formatting_#{$$}"
11
- @output_file = File.join @output_dir, 'rdoc.texinfo'
12
-
13
- RDoc::RDoc.new.document(['--fmt=texinfo', '--quiet',
14
- File.expand_path(__FILE__),
15
- "--op=#{@output_dir}"])
16
- @text = File.read @output_file
17
-
18
- # File.open('rdoc.texinfo', 'w') { |f| f.puts @text }
19
- end
20
-
21
- def teardown
22
- # FileUtils.rm_rf @output_dir
23
- end
24
-
25
- # Make sure tags like *this* do not make HTML
26
- def test_descriptions_are_not_html
27
- assert_no_match Regexp.new("\<b\>this\<\/b\>"), @text, "We had some HTML; icky!"
28
- end
29
-
30
- # Ensure we get a reasonable amount
31
- #
32
- # of space in between paragraphs.
33
- def test_paragraphs_are_spaced
34
- assert_match(/amount\n\n\nof space/, @text)
35
- end
36
-
37
- # @ and {} should be at-sign-prefixed
38
- def test_escaping
39
- assert_match(/@@ and @\{@\} should be at-sign-prefixed/)
40
- end
41
-
42
- # This tests that *bold* and <b>bold me</b> become @strong{bolded}
43
- def test_bold
44
- # Seems like a limitation of the Info format: @strong{bold}
45
- # becomes *bold* when read in Info or M-x info. highly lame!
46
- assert_match(/@strong\{bold\}/)
47
- assert_match(/@strong\{bold me\}/)
48
- end
49
-
50
- # Test that _italics_ and <em>italicize me</em> becomes @emph{italicized}
51
- def test_italics
52
- assert_match(/@emph\{italics\}/)
53
- assert_match(/@emph\{italicize me\}/)
54
- end
55
-
56
- # And that typewriter +text+ and <tt>typewriter me</tt> becomes @code{typewriter}
57
- def test_tt
58
- assert_match(/@code\{text\}/)
59
- assert_match(/@code\{typewriter me\}/)
60
- end
61
-
62
- # Check that
63
- # anything indented is
64
- # verbatim @verb{|foo bar baz|}
65
- def test_literal_code
66
- assert_match("@verb{| anything indented is
67
- verbatim @@verb@{|foo bar baz|@}
68
- |}")
69
- end
70
-
71
- # = Huge heading should be a @majorheading
72
- # == There is also @chapheading
73
- # === Everything deeper becomes a regular @heading
74
- # ====== Regardless of its nesting level
75
- def test_headings
76
- assert_match(/@majorheading Huge heading should be a @@majorheading/)
77
- assert_match(/@chapheading There is also @@chapheading/)
78
- assert_match(/@heading Everything deeper becomes a regular @@heading/)
79
- assert_match(/@heading Regardless of its nesting level/)
80
- end
81
-
82
- # * list item
83
- # * list item2
84
- #
85
- # with a paragraph in between
86
- #
87
- # - hyphen lists
88
- # - are also allowed
89
- # and items may flow over lines
90
- def test_bullet_lists
91
- assert_match("@itemize @bullet
92
- @item
93
- list item
94
- @item
95
- list item2
96
- @end itemize")
97
- assert_match("@itemize @bullet
98
- @item
99
- hyphen lists
100
- @item
101
- are also allowed and items may flow over lines
102
- @end itemize")
103
- end
104
-
105
- # 2. numbered lists
106
- # 8. are made by
107
- # 9. a digit followed by a period
108
- def test_numbered_lists
109
- end
110
-
111
- # a. alpha lists
112
- # b. should be parsed too
113
- def test_alpha_lists
114
- end
115
-
116
- # [cat] small domestic animal
117
- # [+cat+] command to copy standard input
118
- # to standard output
119
- def test_labelled_lists
120
- end
121
-
122
- # * First item.
123
- # * Inner item.
124
- # * Second inner item.
125
- # * Second outer item.
126
- def test_nested_lists
127
- assert_match("@itemize @bullet
128
- @item
129
- First item.
130
- @itemize @bullet
131
- @item
132
- Inner item.
133
- @item
134
- Second inner item.
135
- @end itemize
136
- @item
137
- Second outer item.
138
- @end itemize")
139
- end
140
-
141
- def test_internal_hyperlinks
142
- # be sure to test multi-word hyperlinks as well.
143
- end
144
-
145
- def test_hyperlink_targets
146
- end
147
-
148
- def test_web_links
149
- # An example of the two-argument form: The official
150
- # @uref{ftp://ftp.gnu.org/gnu, GNU ftp site} holds programs and texts.
151
-
152
- # produces:
153
- # The official GNU ftp site (ftp://ftp.gnu.org/gnu)
154
- # holds programs and texts.
155
- # and the HTML output is this:
156
- # The official <a href="ftp://ftp.gnu.org/gnu">GNU ftp site</a>
157
- # holds programs and texts.
158
- end
159
-
160
- # three or more hyphens
161
- # ----
162
- # should produce a horizontal rule
163
- def test_horizontal_rule
164
- # gah; not sure texinfo supports horizontal rules
165
- end
166
-
167
- private
168
-
169
- # We don't want the whole string inspected if we pass our own
170
- # message in.
171
- def assert_match(regex, string = @text,
172
- message = "Didn't find #{regex.inspect} in #{string}.")
173
- assert string[regex] #, message
174
- end
175
- end
@@ -1,136 +0,0 @@
1
- require 'fileutils'
2
- require 'tempfile'
3
- require 'test/unit'
4
- require 'tmpdir'
5
-
6
- require 'rdoc/generator/texinfo'
7
-
8
- # give us access to check this stuff before it's rendered
9
- class RDoc::Generator::TEXINFO; attr_reader :files, :classes; end
10
- class RDoc::RDoc; attr_reader :options; attr_reader :gen; end
11
-
12
- class TestRDocInfoSections < Test::Unit::TestCase
13
-
14
- def setup
15
- @output_dir = File.join Dir.tmpdir, "test_rdoc_info_sections_#{$$}"
16
- @output_file = File.join @output_dir, 'rdoc.texinfo'
17
-
18
- @input_file = Tempfile.new 'my_file.rb'
19
-
20
- open @input_file.path, 'w' do |io|
21
- io.write TEST_DOC
22
- end
23
-
24
- RDoc::Parser.alias_extension '.rb', File.extname(@input_file.path)
25
-
26
- @rdoc = RDoc::RDoc.new
27
- @rdoc.document(['--fmt=texinfo', '--quiet', @input_file.path,
28
- "--op=#{@output_dir}"])
29
-
30
- @text = File.read @output_file
31
- end
32
-
33
- def teardown
34
- @input_file.close
35
- FileUtils.rm_rf @output_dir
36
- end
37
-
38
- def test_output_exists
39
- assert ! @text.empty?
40
- end
41
-
42
- def test_each_class_has_a_chapter
43
- assert_section "Class MyClass", '@chapter'
44
- end
45
-
46
- def test_class_descriptions_are_given
47
- assert_match(/Documentation for my class/, @text.gsub("\n", ' '))
48
- end
49
-
50
- def test_included_modules_are_given
51
- assert_match(/Includes.* MyModule/m, @text)
52
- end
53
-
54
- def test_class_methods_are_given
55
- assert_match(/my_class_method\(my_first_argument\)/, @text)
56
- end
57
-
58
- def test_classes_instance_methods_are_given
59
- assert_section 'Class MyClass#my_method'
60
- assert_match(/my_method\(my_first_argument\)/, @text)
61
- end
62
-
63
- def test_each_module_has_a_chapter
64
- assert_section 'MyModule', '@chapter'
65
- end
66
-
67
- def test_methods_are_shown_only_once
68
- methods = @rdoc.gen.classes.map do |c|
69
- c.methods.map do |m|
70
- c.name + '#' + m.name
71
- end
72
- end.flatten
73
-
74
- assert_equal methods, methods.uniq
75
- end
76
-
77
- # if system "makeinfo --version > /dev/null"
78
- # def test_compiles_to_info
79
- # makeinfo_output = `cd #{@output_dir} && makeinfo rdoc.texinfo`
80
- # assert(File.exist?(File.join(@output_dir, 'rdoc.info')),
81
- # "Info file was not compiled: #{makeinfo_output}")
82
- # end
83
- # end
84
-
85
- # def test_constants_are_documented_somehow
86
- # assert_section 'DEFAULT_FILENAME' # what kind of section?
87
- # assert_section 'DEFAULT_INFO_FILENAME'
88
- # end
89
-
90
- # def test_oh_yeah_dont_forget_files
91
- # end
92
-
93
- def assert_section(name, command = '@section')
94
- assert_match Regexp.new("^#{command}.*#{Regexp.escape name}"), @text, "Could not find a #{command} #{name}"
95
- end
96
-
97
- TEST_DOC = <<-DOC
98
- ##
99
- # Documentation for my module
100
-
101
- module MyModule
102
-
103
- ##
104
- # Documentation for my included method
105
-
106
- def my_included_method() end
107
-
108
- end
109
-
110
- ##
111
- # Documentation for my class
112
-
113
- class MyClass
114
-
115
- include MyModule
116
-
117
- ##
118
- # Documentation for my constant
119
-
120
- MY_CONSTANT = 'my value'
121
-
122
- ##
123
- # Documentation for my class method
124
-
125
- def self.my_class_method(my_first_argument) end
126
-
127
- ##
128
- # Documentation for my method
129
-
130
- def my_method(my_first_argument) end
131
-
132
- end
133
-
134
- DOC
135
-
136
- end