rdoc 6.14.2 → 6.15.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +112 -0
  3. data/RI.md +1 -1
  4. data/lib/rdoc/code_object/top_level.rb +0 -8
  5. data/lib/rdoc/cross_reference.rb +1 -1
  6. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
  7. data/lib/rdoc/generator/template/darkfish/_head.rhtml +14 -14
  8. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -8
  9. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -8
  10. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
  11. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +6 -6
  12. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +19 -19
  13. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +2 -2
  14. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +3 -3
  15. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +14 -14
  16. data/lib/rdoc/generator/template/darkfish/class.rhtml +62 -60
  17. data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -3
  18. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +21 -1
  19. data/lib/rdoc/generator/template/darkfish/js/search.js +11 -1
  20. data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -1
  21. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +2 -1
  22. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +19 -19
  23. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +19 -17
  24. data/lib/rdoc/generator/template/json_index/js/searcher.js +44 -6
  25. data/lib/rdoc/markdown.kpeg +28 -17
  26. data/lib/rdoc/markdown.rb +365 -544
  27. data/lib/rdoc/markup/to_html.rb +156 -10
  28. data/lib/rdoc/markup/to_html_crossref.rb +53 -23
  29. data/lib/rdoc/options.rb +1 -1
  30. data/lib/rdoc/ri/task.rb +2 -2
  31. data/lib/rdoc/store.rb +2 -2
  32. data/lib/rdoc/task.rb +4 -4
  33. data/lib/rdoc/version.rb +1 -1
  34. data/rdoc.gemspec +3 -2
  35. metadata +19 -5
  36. data/README.rdoc +0 -144
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff34d02bfaa6b5e36bd3ab29b6fdfc10e41a50ba0fbef3841aed3e59d22e8d29
4
- data.tar.gz: bee9f682708babef768b5fe0b5b68a505ad09ba255c20c00fdefb52cd5135566
3
+ metadata.gz: ed79e2cda1c5cd7113829e3fcfbbece5c1d5332e9046778c2581d28059afd9e7
4
+ data.tar.gz: cc77a3249231ee94df7d06090d9a683e0c7f71f5924186e2f0dcae5b01ec5b74
5
5
  SHA512:
6
- metadata.gz: 10729c09826000d5ac6d4137fdba80b36dd7da96c66475ee03fcfe527dd159a74f41ec8c1a5cb588373c4007ea02a18cd9ca5e09e1766125daab7e84ca17a6ae
7
- data.tar.gz: 785c69b91032d0e72810f91c56271d100d03439355bda96f808faaea60ec2768caab376a8420bbbb72e7bbeb6c50a06ed5a002c668342aa80444ee7d0b1c2a6f
6
+ metadata.gz: 43bd516f9ffb4f33e76c6186c8b0429525d4729172a25de895a2f1d69f7c523bdc8868c42dc55dc17863f6daa927a56d1aaefbb9edc5519a4885f2a5b60e0cbf
7
+ data.tar.gz: 368780ba1a40869aa6a26e2a5734d13bb5ec25e4d47dcea78cb0de2c117bad7b8e964ea69b857aadc799f492f72d51a7d68a7259f357c2d23c9a13064c33ce3b
data/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # RDoc - Ruby Documentation System
2
+
3
+ - GitHub: [https://github.com/ruby/rdoc](https://github.com/ruby/rdoc)
4
+ - Issues: [https://github.com/ruby/rdoc/issues](https://github.com/ruby/rdoc/issues)
5
+
6
+ ## Description
7
+
8
+ RDoc produces HTML and command-line documentation for Ruby projects. RDoc includes the `rdoc` and `ri` tools for generating and displaying documentation from the command-line.
9
+
10
+ ## Generating Documentation
11
+
12
+ Once installed, you can create documentation using the `rdoc` command
13
+
14
+ ```shell
15
+ rdoc [options] [names...]
16
+ ```
17
+
18
+ For an up-to-date option summary, type
19
+
20
+ ```shell
21
+ rdoc --help
22
+ ```
23
+
24
+ A typical use might be to generate documentation for a package of Ruby source (such as RDoc itself).
25
+
26
+ ```shell
27
+ rdoc
28
+ ```
29
+
30
+ This command generates documentation for all the Ruby and C source files in and below the current directory. These will be stored in a documentation tree starting in the subdirectory `doc`.
31
+
32
+ You can make this slightly more useful for your readers by having the index page contain the documentation for the primary file. In our case, we could type
33
+
34
+ ```shell
35
+ rdoc --main README.md
36
+ ```
37
+
38
+ You'll find information on the various formatting tricks you can use in comment blocks in the documentation this generates.
39
+
40
+ RDoc uses file extensions to determine how to process each file. File names ending `.rb` and `.rbw` are assumed to be Ruby source. Files ending `.c` are parsed as C files. All other files are assumed to contain just Markup-style markup (with or without leading `#` comment markers). If directory names are passed to RDoc, they are scanned recursively for C and Ruby source files only.
41
+
42
+ To generate documentation using `rake` see [RDoc::Task](https://ruby.github.io/rdoc/RDoc/Task.html).
43
+
44
+ To generate documentation programmatically:
45
+
46
+ ```rb
47
+ require 'rdoc/rdoc'
48
+
49
+ options = RDoc::Options.new
50
+ options.files = ['a.rb', 'b.rb']
51
+ options.setup_generator 'darkfish'
52
+ # see RDoc::Options
53
+
54
+ rdoc = RDoc::RDoc.new
55
+ rdoc.document options
56
+ # see RDoc::RDoc
57
+ ```
58
+
59
+ You can specify the target files for document generation with `.document` file in the project root directory. `.document` file contains a list of file and directory names including comment lines starting with `#`. See [https://github.com/ruby/rdoc/blob/master/.document](https://github.com/ruby/rdoc/blob/master/.document) as an example.
60
+
61
+ ## Writing Documentation
62
+
63
+ To write documentation for RDoc place a comment above the class, module, method, constant, or attribute you want documented:
64
+
65
+ ```rb
66
+ ##
67
+ # This class represents an arbitrary shape by a series of points.
68
+ class Shape
69
+ ##
70
+ # Creates a new shape described by a +polyline+.
71
+ #
72
+ # If the +polyline+ does not end at the same point it started at the
73
+ # first pointed is copied and placed at the end of the line.
74
+ #
75
+ # An ArgumentError is raised if the line crosses itself, but shapes may
76
+ # be concave.
77
+ def initialize polyline
78
+ # ...
79
+ end
80
+ end
81
+ ```
82
+
83
+ The default comment markup format is the RDoc::Markup format. TomDoc, Markdown and RD format comments are also supported. You can set the default comment format for your entire project by creating a `.rdoc_options` file. See RDoc::Options@Saved+Options for instructions on creating one. You can also set the comment format for a single file through the `:markup:` directive, but this is only recommended if you wish to switch markup formats. See RDoc::Markup@Other+directives.
84
+
85
+ Comments can contain directives that tell RDoc information that it cannot otherwise discover through parsing. See RDoc::Markup@Directives to control what is or is not documented, to define method arguments or to break up methods in a class by topic. See RDoc::Parser::Ruby for directives used to teach RDoc about metaprogrammed methods.
86
+
87
+ See RDoc::Parser::C for documenting C extensions with RDoc.
88
+
89
+ To determine how well your project is documented run `rdoc -C lib` to get a documentation coverage report. `rdoc -C1 lib` includes parameter names in the documentation coverage report.
90
+
91
+ ## Theme Options
92
+
93
+ There are a few community-maintained themes for RDoc:
94
+
95
+ - [rorvswild-theme-rdoc](https://github.com/BaseSecrete/rorvswild-theme-rdoc)
96
+ - [hanna](https://github.com/jeremyevans/hanna) (a fork maintained by [Jeremy Evans](https://github.com/jeremyevans))
97
+
98
+ Please follow the theme's README for usage instructions.
99
+
100
+ ## Bugs
101
+
102
+ See CONTRIBUTING.rdoc for information on filing a bug report. It's OK to file a bug report for anything you're having a problem with. If you can't figure out how to make RDoc produce the output you like that is probably a documentation bug.
103
+
104
+ ## License
105
+
106
+ RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers. Portions (c) 2007-2011 Eric Hodel. Portions copyright others, see individual files and LEGAL.rdoc for details.
107
+
108
+ RDoc is free software, and may be redistributed under the terms specified in LICENSE.rdoc.
109
+
110
+ ## Warranty
111
+
112
+ This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.
data/RI.md CHANGED
@@ -48,7 +48,7 @@ the [Ruby online documentation](https://docs.ruby-lang.org/en/master):
48
48
  - If you are working in a terminal window, typing `ri _whatever_` (or just `ri`)
49
49
  may be faster than navigating to a browser window and searching for documentation.
50
50
  - If you are working in an
51
- [irb \(interactive Ruby\)](https://docs.ruby-lang.org/en/master/IRB.html)
51
+ [irb \(interactive Ruby\)](https://ruby.github.io/irb/index.html)
52
52
  session, you _already_ have immediate access to `ri`:
53
53
  just type `'show_doc'`.
54
54
 
@@ -114,14 +114,6 @@ class RDoc::TopLevel < RDoc::Context
114
114
 
115
115
  alias name base_name
116
116
 
117
- ##
118
- # Only a TopLevel that contains text file) will be displayed. See also
119
- # RDoc::CodeObject#display?
120
-
121
- def display?
122
- text? and super
123
- end
124
-
125
117
  ##
126
118
  # See RDoc::TopLevel::find_class_or_module
127
119
  #--
@@ -200,7 +200,7 @@ class RDoc::CrossReference
200
200
  ref = resolve_method name unless ref
201
201
 
202
202
  # Try a page name
203
- ref = @store.page name if not ref and name =~ /^[\w.]+$/
203
+ ref = @store.page name if not ref and name =~ /^[\w.\/]+$/
204
204
 
205
205
  ref = nil if RDoc::Alias === ref # external alias, can't link to it
206
206
 
@@ -1,5 +1,5 @@
1
1
  <footer id="validator-badges" role="contentinfo">
2
- <p><a href="https://validator.w3.org/check/referer">Validate</a>
3
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> <%= RDoc::VERSION %>.
4
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
2
+ <p><a href="https://validator.w3.org/check/referer">Validate</a></p>
3
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> <%= RDoc::VERSION %>.</p>
4
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>
5
5
  </footer>
@@ -1,34 +1,34 @@
1
1
  <meta charset="<%= @options.charset %>">
2
- <meta name="viewport" content="width=device-width, initial-scale=1" />
2
+ <meta name="viewport" content="width=device-width, initial-scale=1">
3
3
 
4
4
  <title><%= h @title %></title>
5
5
 
6
- <%- if defined?(klass) -%>
6
+ <%- if defined?(klass) %>
7
7
  <meta name="keywords" content="ruby,<%= h "#{klass.type},#{klass.full_name}" %>">
8
8
 
9
- <%- if klass.comment.empty? -%>
9
+ <%- if klass.comment.empty? %>
10
10
  <meta name="description" content="Documentation for the <%= h "#{klass.full_name} #{klass.type}" %>">
11
- <%- else -%>
11
+ <%- else %>
12
12
  <meta name="description" content="<%= h "#{klass.type} #{klass.full_name}: #{excerpt(klass.comment)}" %>">
13
- <%- end -%>
14
- <%- elsif defined?(file) -%>
13
+ <%- end %>
14
+ <%- elsif defined?(file) %>
15
15
  <meta name="keywords" content="ruby,documentation,<%= h file.page_name %>">
16
16
  <meta name="description" content="<%= h "#{file.page_name}: #{excerpt(file.comment)}" %>">
17
- <%- elsif @title -%>
17
+ <%- elsif @title %>
18
18
  <meta name="keywords" content="ruby,documentation,<%= h @title %>">
19
19
 
20
20
  <%- if @options.main_page and
21
21
  main_page = @files.find { |f| f.full_name == @options.main_page } then %>
22
22
  <meta name="description" content="<%= h "#{@title}: #{excerpt(main_page.comment)}" %>">
23
- <%- else -%>
23
+ <%- else %>
24
24
  <meta name="description" content="Documentation for <%= h @title %>">
25
- <%- end -%>
26
- <%- end -%>
25
+ <%- end %>
26
+ <%- end %>
27
27
 
28
- <%- if canonical_url = @options.canonical_root -%>
28
+ <%- if canonical_url = @options.canonical_root %>
29
29
  <% canonical_url = current.canonical_url if defined?(current) %>
30
30
  <link rel="canonical" href="<%= canonical_url %>">
31
- <%- end -%>
31
+ <%- end %>
32
32
 
33
33
  <script type="text/javascript">
34
34
  var rdoc_rel_prefix = "<%= h asset_rel_prefix %>/";
@@ -43,6 +43,6 @@
43
43
 
44
44
  <link href="<%= h asset_rel_prefix %>/css/fonts.css" rel="stylesheet">
45
45
  <link href="<%= h asset_rel_prefix %>/css/rdoc.css" rel="stylesheet">
46
- <%- @options.template_stylesheets.each do |stylesheet| -%>
46
+ <%- @options.template_stylesheets.each do |stylesheet| %>
47
47
  <link href="<%= h asset_rel_prefix %>/<%= File.basename stylesheet %>" rel="stylesheet">
48
- <%- end -%>
48
+ <%- end %>
@@ -3,13 +3,13 @@
3
3
  <h3>Extended With Modules</h3>
4
4
 
5
5
  <ul class="link-list">
6
- <%- klass.extends.each do |ext| -%>
7
- <%- unless String === ext.module then -%>
8
- <li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a>
9
- <%- else -%>
10
- <li><span class="extend"><%= ext.name %></span>
11
- <%- end -%>
12
- <%- end -%>
6
+ <%- klass.extends.each do |ext| %>
7
+ <%- unless String === ext.module then %>
8
+ <li><a class="extend" href="<%= klass.aref_to ext.module.path %>"><%= ext.module.full_name %></a></li>
9
+ <%- else %>
10
+ <li><span class="extend"><%= ext.name %></span></li>
11
+ <%- end %>
12
+ <%- end %>
13
13
  </ul>
14
14
  </div>
15
- <%- end -%>
15
+ <%- end %>
@@ -3,13 +3,13 @@
3
3
  <h3>Included Modules</h3>
4
4
 
5
5
  <ul class="link-list">
6
- <%- klass.includes.each do |inc| -%>
7
- <%- unless String === inc.module then -%>
8
- <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a>
9
- <%- else -%>
10
- <li><span class="include"><%= inc.name %></span>
11
- <%- end -%>
12
- <%- end -%>
6
+ <%- klass.includes.each do |inc| %>
7
+ <%- unless String === inc.module then %>
8
+ <li><a class="include" href="<%= klass.aref_to inc.module.path %>"><%= inc.module.full_name %></a></li>
9
+ <%- else %>
10
+ <li><span class="include"><%= inc.name %></span></li>
11
+ <%- end %>
12
+ <%- end %>
13
13
  </ul>
14
14
  </div>
15
- <%- end -%>
15
+ <%- end %>
@@ -2,14 +2,15 @@
2
2
  <h3>Documentation</h3>
3
3
 
4
4
  <ul>
5
- <%- installed.each do |name, href, exists, type, _| -%>
6
- <%- next if type == :extra -%>
5
+ <%- installed.each do |name, href, exists, type, _| %>
6
+ <%- next if type == :extra %>
7
7
  <li class="folder">
8
- <%- if exists then -%>
8
+ <%- if exists then %>
9
9
  <a href="<%= href %>"><%= h name %></a>
10
- <%- else -%>
10
+ <%- else %>
11
11
  <%= h name %>
12
- <%- end -%>
13
- <%- end -%>
12
+ <%- end %>
13
+ </li>
14
+ <%- end %>
14
15
  </ul>
15
16
  </div>
@@ -2,9 +2,9 @@
2
2
  <div class="nav-section">
3
3
  <h3>Class Methods</h3>
4
4
  <ul class="link-list" role="directory">
5
- <%- class_methods.each do |meth| -%>
6
- <li <%- if meth.calls_super %>class="calls-super" <%- end %>><a href="#<%= meth.aref %>"><%= h meth.name -%></a></li>
7
- <%- end -%>
5
+ <%- class_methods.each do |meth| %>
6
+ <li <%- if meth.calls_super %>class="calls-super" <%- end %>><a href="#<%= meth.aref %>"><%= h meth.name %></a></li>
7
+ <%- end %>
8
8
  </ul>
9
9
  </div>
10
10
  <% end %>
@@ -13,9 +13,9 @@
13
13
  <div class="nav-section">
14
14
  <h3>Instance Methods</h3>
15
15
  <ul class="link-list" role="directory">
16
- <%- instance_methods.each do |meth| -%>
17
- <li <%- if meth.calls_super %>class="calls-super" <%- end %>><a href="#<%= meth.aref %>"><%= h meth.name -%></a></li>
18
- <%- end -%>
16
+ <%- instance_methods.each do |meth| %>
17
+ <li <%- if meth.calls_super %>class="calls-super" <%- end %>><a href="#<%= meth.aref %>"><%= h meth.name %></a></li>
18
+ <%- end %>
19
19
  </ul>
20
20
  </div>
21
21
  <% end %>
@@ -1,32 +1,32 @@
1
1
  <%- simple_files = @files.select { |f| f.text? } %>
2
- <%- if defined?(current) -%>
3
- <%- dir = current.full_name[%r{\A[^/]+(?=/)}] || current.page_name -%>
4
- <%- end -%>
5
- <%- unless simple_files.empty? then -%>
2
+ <%- if defined?(current) %>
3
+ <%- dir = current.full_name[%r{\A[^/]+(?=/)}] || current.page_name %>
4
+ <%- end %>
5
+ <%- unless simple_files.empty? then %>
6
6
  <div id="fileindex-section" class="nav-section">
7
7
  <h3>Pages</h3>
8
8
 
9
9
  <ul class="link-list">
10
- <%- simple_files.group_by do |f| -%>
11
- <%- f.full_name[%r{\A[^/]+(?=/)}] || f.page_name -%>
12
- <%- end.each do |n, files| -%>
13
- <%- f = files.shift -%>
14
- <%- if files.empty? -%>
15
- <li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a>
16
- <%- next -%>
17
- <%- end -%>
18
- <li><details<% if dir == n %> open<% end %>><summary><%
10
+ <%- simple_files.group_by do |f|
11
+ f.full_name[%r{\A[^/]+(?=/)}] || f.page_name
12
+ end.each do |n, files| %>
13
+ <%- f = files.shift %>
14
+ <%- if files.empty? %>
15
+ <li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a></li>
16
+ <%- next %>
17
+ <%- end %>
18
+ <li><details<%= ' open' if dir == n %>><summary><%
19
19
  if n == f.page_name
20
20
  %><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h n %></a><%
21
21
  else
22
22
  %><%= h n %><% files.unshift(f)
23
23
  end %></summary>
24
24
  <ul class="link-list">
25
- <%- files.each do |f| -%>
26
- <li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a>
27
- <%- end -%>
28
- </ul></details>
29
- <%- end -%>
25
+ <%- files.each do |f| %>
26
+ <li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a></li>
27
+ <%- end %>
28
+ </ul></details></li>
29
+ <%- end %>
30
30
  </ul>
31
31
  </div>
32
- <%- end -%>
32
+ <%- end %>
@@ -1,6 +1,6 @@
1
- <%- if klass.type == 'class' && (ancestors = klass.super_classes).any? -%>
1
+ <%- if klass.type == 'class' && (ancestors = klass.super_classes).any? %>
2
2
  <div id="parent-class-section" class="nav-section">
3
3
  <h3>Ancestors</h3>
4
4
  <%= generate_ancestor_list(ancestors, klass) %>
5
5
  </div>
6
- <%- end -%>
6
+ <%- end %>
@@ -3,9 +3,9 @@
3
3
  <h3>Sections</h3>
4
4
 
5
5
  <ul class="link-list" role="directory">
6
- <%- klass.sort_sections.each do |section| -%>
6
+ <%- klass.sort_sections.each do |section| %>
7
7
  <li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
8
- <%- end -%>
8
+ <%- end %>
9
9
  </ul>
10
10
  </div>
11
- <%- end -%>
11
+ <%- end %>
@@ -9,31 +9,31 @@
9
9
  <div class="nav-section">
10
10
  <h3>Table of Contents</h3>
11
11
 
12
- <%- display_link = proc do |heading| -%>
12
+ <%- display_link = proc do |heading| %>
13
13
  <a href="#<%= heading.label current %>"><%= heading.plain_html %></a>
14
- <%- end -%>
14
+ <%- end %>
15
15
 
16
- <%- list_siblings = proc do -%>
17
- <%- level = table.first&.level -%>
18
- <%- while table.first && table.first.level >= level -%>
19
- <%- heading = table.shift -%>
20
- <%- if table.first.nil? || table.first.level <= heading.level -%>
21
- <li><% display_link.call heading -%>
22
- <%- else -%>
16
+ <%- list_siblings = proc do %>
17
+ <%- level = table.first&.level %>
18
+ <%- while table.first && table.first.level >= level %>
19
+ <%- heading = table.shift %>
20
+ <%- if table.first.nil? || table.first.level <= heading.level %>
21
+ <li><% display_link.call heading %></li>
22
+ <%- else %>
23
23
  <li>
24
24
  <details open>
25
- <summary><%- display_link.call heading -%></summary>
25
+ <summary><%- display_link.call heading %></summary>
26
26
  <ul class="link-list" role="directory">
27
27
  <% list_siblings.call %>
28
28
  </ul>
29
29
  </details>
30
30
  </li>
31
- <%- end -%>
32
- <%- end -%>
33
- <%- end -%>
31
+ <%- end %>
32
+ <%- end %>
33
+ <%- end %>
34
34
 
35
35
  <ul class="link-list" role="directory">
36
36
  <% list_siblings.call %>
37
37
  </ul>
38
38
  </div>
39
- <%- end -%>
39
+ <%- end %>