rdoc 6.14.2 → 7.0.3

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 (97) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +196 -0
  3. data/History.rdoc +1 -1
  4. data/LEGAL.rdoc +6 -0
  5. data/README.md +129 -0
  6. data/RI.md +1 -1
  7. data/lib/rdoc/code_object/any_method.rb +15 -7
  8. data/lib/rdoc/code_object/class_module.rb +38 -8
  9. data/lib/rdoc/code_object/constant.rb +9 -0
  10. data/lib/rdoc/code_object/method_attr.rb +13 -1
  11. data/lib/rdoc/code_object/top_level.rb +31 -26
  12. data/lib/rdoc/comment.rb +190 -8
  13. data/lib/rdoc/cross_reference.rb +1 -1
  14. data/lib/rdoc/generator/aliki.rb +183 -0
  15. data/lib/rdoc/generator/darkfish.rb +8 -2
  16. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  17. data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  18. data/lib/rdoc/generator/template/aliki/_head.rhtml +158 -0
  19. data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  20. data/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  21. data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  22. data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  23. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +25 -0
  24. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +25 -0
  25. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  26. data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  27. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  28. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  29. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  30. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  31. data/lib/rdoc/generator/template/aliki/class.rhtml +218 -0
  32. data/lib/rdoc/generator/template/aliki/css/rdoc.css +1943 -0
  33. data/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  34. data/lib/rdoc/generator/template/aliki/js/aliki.js +505 -0
  35. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  36. data/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
  37. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  38. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  39. data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  40. data/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  41. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  42. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  43. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
  44. data/lib/rdoc/generator/template/darkfish/_head.rhtml +14 -19
  45. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -8
  46. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -8
  47. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
  48. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +6 -6
  49. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +18 -18
  50. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +2 -2
  51. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -0
  52. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +3 -3
  53. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +14 -14
  54. data/lib/rdoc/generator/template/darkfish/class.rhtml +68 -68
  55. data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -3
  56. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +21 -1
  57. data/lib/rdoc/generator/template/darkfish/js/search.js +11 -1
  58. data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -1
  59. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +2 -1
  60. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +19 -19
  61. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +19 -17
  62. data/lib/rdoc/generator/template/json_index/js/searcher.js +48 -6
  63. data/lib/rdoc/generator.rb +1 -0
  64. data/lib/rdoc/markdown.kpeg +28 -17
  65. data/lib/rdoc/markdown.rb +365 -544
  66. data/lib/rdoc/markup/blank_line.rb +25 -23
  67. data/lib/rdoc/markup/element.rb +21 -0
  68. data/lib/rdoc/markup/hard_break.rb +30 -27
  69. data/lib/rdoc/markup/heading.rb +96 -79
  70. data/lib/rdoc/markup/pre_process.rb +34 -10
  71. data/lib/rdoc/markup/raw.rb +52 -55
  72. data/lib/rdoc/markup/table.rb +48 -40
  73. data/lib/rdoc/markup/to_ansi.rb +4 -0
  74. data/lib/rdoc/markup/to_bs.rb +4 -0
  75. data/lib/rdoc/markup/to_html.rb +162 -14
  76. data/lib/rdoc/markup/to_html_crossref.rb +53 -23
  77. data/lib/rdoc/markup/to_rdoc.rb +11 -3
  78. data/lib/rdoc/markup.rb +1 -0
  79. data/lib/rdoc/options.rb +22 -11
  80. data/lib/rdoc/parser/c.rb +15 -46
  81. data/lib/rdoc/parser/prism_ruby.rb +121 -113
  82. data/lib/rdoc/parser/ruby.rb +8 -8
  83. data/lib/rdoc/parser/ruby_tools.rb +5 -7
  84. data/lib/rdoc/parser/simple.rb +4 -21
  85. data/lib/rdoc/rdoc.rb +1 -0
  86. data/lib/rdoc/ri/task.rb +2 -2
  87. data/lib/rdoc/rubygems_hook.rb +3 -3
  88. data/lib/rdoc/store.rb +2 -2
  89. data/lib/rdoc/task.rb +4 -4
  90. data/lib/rdoc/text.rb +1 -1
  91. data/lib/rdoc/token_stream.rb +13 -1
  92. data/lib/rdoc/tom_doc.rb +1 -1
  93. data/lib/rdoc/version.rb +1 -1
  94. data/rdoc.gemspec +4 -3
  95. metadata +51 -8
  96. data/CONTRIBUTING.rdoc +0 -219
  97. data/README.rdoc +0 -144
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  ##
3
4
  # A TokenStream is a list of tokens, gathered during the parse of some entity
4
5
  # (say a method). Entities populate these streams by being registered with the
@@ -87,9 +88,11 @@ module RDoc::TokenStream
87
88
 
88
89
  ##
89
90
  # Starts collecting tokens
91
+ #
90
92
 
91
- def collect_tokens
93
+ def collect_tokens(language)
92
94
  @token_stream = []
95
+ @token_stream_language = language
93
96
  end
94
97
 
95
98
  alias start_collecting_tokens collect_tokens
@@ -115,4 +118,13 @@ module RDoc::TokenStream
115
118
  (token_stream or return '').compact.map { |token| token[:text] }.join ''
116
119
  end
117
120
 
121
+ ##
122
+ # Returns the source language of the token stream as a string
123
+ #
124
+ # Returns 'c' or 'ruby'
125
+
126
+ def source_language
127
+ @token_stream_language == :c ? 'c' : 'ruby'
128
+ end
129
+
118
130
  end
data/lib/rdoc/tom_doc.rb CHANGED
@@ -49,7 +49,7 @@ class RDoc::TomDoc < RDoc::Markup::Parser
49
49
  next unless code_object and
50
50
  RDoc::Comment === comment and comment.format == 'tomdoc'
51
51
 
52
- comment.text.gsub!(/(\A\s*# )(Public|Internal|Deprecated):\s+/) do
52
+ comment.text.gsub!(/\A(\s*# |)(Public|Internal|Deprecated):\s+/) do
53
53
  section = code_object.add_section $2
54
54
  code_object.temporary_section = section
55
55
 
data/lib/rdoc/version.rb CHANGED
@@ -5,6 +5,6 @@ module RDoc
5
5
  ##
6
6
  # RDoc version you are using
7
7
 
8
- VERSION = '6.14.2'
8
+ VERSION = '7.0.3'
9
9
 
10
10
  end
data/rdoc.gemspec CHANGED
@@ -38,14 +38,14 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
38
38
  # for ruby core repository. It was generated by
39
39
  # `git ls-files -z`.split("\x0").each {|f| puts " #{f.dump}," unless f.start_with?(*%W[test/ spec/ features/ .]) }
40
40
  non_lib_files = [
41
- "CONTRIBUTING.rdoc",
41
+ "CONTRIBUTING.md",
42
42
  "CVE-2013-0256.rdoc",
43
43
  "ExampleMarkdown.md",
44
44
  "ExampleRDoc.rdoc",
45
45
  "History.rdoc",
46
46
  "LEGAL.rdoc",
47
47
  "LICENSE.rdoc",
48
- "README.rdoc",
48
+ "README.md",
49
49
  "RI.md",
50
50
  "TODO.rdoc",
51
51
  "exe/rdoc",
@@ -60,7 +60,7 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
60
60
 
61
61
  s.files = (non_lib_files + template_files + lib_files).uniq
62
62
 
63
- s.rdoc_options = ["--main", "README.rdoc"]
63
+ s.rdoc_options = ["--main", "README.md"]
64
64
  s.extra_rdoc_files += s.files.grep(%r[\A[^\/]+\.(?:rdoc|md)\z])
65
65
 
66
66
  s.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
@@ -68,4 +68,5 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
68
68
 
69
69
  s.add_dependency 'psych', '>= 4.0.0'
70
70
  s.add_dependency 'erb'
71
+ s.add_dependency 'tsort'
71
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.14.2
4
+ version: 7.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -13,7 +13,7 @@ authors:
13
13
  - ITOYANAGI Sakura
14
14
  bindir: exe
15
15
  cert_chain: []
16
- date: 2025-07-03 00:00:00.000000000 Z
16
+ date: 2025-12-24 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: psych
@@ -43,6 +43,20 @@ dependencies:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: tsort
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ type: :runtime
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
46
60
  description: |
47
61
  RDoc produces HTML and command-line documentation for Ruby projects.
48
62
  RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentation from the command-line.
@@ -59,25 +73,25 @@ executables:
59
73
  - ri
60
74
  extensions: []
61
75
  extra_rdoc_files:
62
- - CONTRIBUTING.rdoc
76
+ - CONTRIBUTING.md
63
77
  - CVE-2013-0256.rdoc
64
78
  - ExampleMarkdown.md
65
79
  - ExampleRDoc.rdoc
66
80
  - History.rdoc
67
81
  - LEGAL.rdoc
68
82
  - LICENSE.rdoc
69
- - README.rdoc
83
+ - README.md
70
84
  - RI.md
71
85
  - TODO.rdoc
72
86
  files:
73
- - CONTRIBUTING.rdoc
87
+ - CONTRIBUTING.md
74
88
  - CVE-2013-0256.rdoc
75
89
  - ExampleMarkdown.md
76
90
  - ExampleRDoc.rdoc
77
91
  - History.rdoc
78
92
  - LEGAL.rdoc
79
93
  - LICENSE.rdoc
80
- - README.rdoc
94
+ - README.md
81
95
  - RI.md
82
96
  - TODO.rdoc
83
97
  - exe/rdoc
@@ -110,6 +124,7 @@ files:
110
124
  - lib/rdoc/erb_partial.rb
111
125
  - lib/rdoc/erbio.rb
112
126
  - lib/rdoc/generator.rb
127
+ - lib/rdoc/generator/aliki.rb
113
128
  - lib/rdoc/generator/darkfish.rb
114
129
  - lib/rdoc/generator/json_index.rb
115
130
  - lib/rdoc/generator/markup.rb
@@ -118,6 +133,33 @@ files:
118
133
  - lib/rdoc/generator/pot/po.rb
119
134
  - lib/rdoc/generator/pot/po_entry.rb
120
135
  - lib/rdoc/generator/ri.rb
136
+ - lib/rdoc/generator/template/aliki/_aside_toc.rhtml
137
+ - lib/rdoc/generator/template/aliki/_footer.rhtml
138
+ - lib/rdoc/generator/template/aliki/_head.rhtml
139
+ - lib/rdoc/generator/template/aliki/_header.rhtml
140
+ - lib/rdoc/generator/template/aliki/_icons.rhtml
141
+ - lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml
142
+ - lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml
143
+ - lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml
144
+ - lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml
145
+ - lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml
146
+ - lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml
147
+ - lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml
148
+ - lib/rdoc/generator/template/aliki/_sidebar_search.rhtml
149
+ - lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml
150
+ - lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml
151
+ - lib/rdoc/generator/template/aliki/class.rhtml
152
+ - lib/rdoc/generator/template/aliki/css/rdoc.css
153
+ - lib/rdoc/generator/template/aliki/index.rhtml
154
+ - lib/rdoc/generator/template/aliki/js/aliki.js
155
+ - lib/rdoc/generator/template/aliki/js/c_highlighter.js
156
+ - lib/rdoc/generator/template/aliki/js/search_controller.js
157
+ - lib/rdoc/generator/template/aliki/js/search_navigation.js
158
+ - lib/rdoc/generator/template/aliki/js/search_ranker.js
159
+ - lib/rdoc/generator/template/aliki/js/theme-toggle.js
160
+ - lib/rdoc/generator/template/aliki/page.rhtml
161
+ - lib/rdoc/generator/template/aliki/servlet_not_found.rhtml
162
+ - lib/rdoc/generator/template/aliki/servlet_root.rhtml
121
163
  - lib/rdoc/generator/template/darkfish/_footer.rhtml
122
164
  - lib/rdoc/generator/template/darkfish/_head.rhtml
123
165
  - lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
@@ -192,6 +234,7 @@ files:
192
234
  - lib/rdoc/markup/blank_line.rb
193
235
  - lib/rdoc/markup/block_quote.rb
194
236
  - lib/rdoc/markup/document.rb
237
+ - lib/rdoc/markup/element.rb
195
238
  - lib/rdoc/markup/formatter.rb
196
239
  - lib/rdoc/markup/hard_break.rb
197
240
  - lib/rdoc/markup/heading.rb
@@ -268,7 +311,7 @@ metadata:
268
311
  changelog_uri: https://github.com/ruby/rdoc/releases
269
312
  rdoc_options:
270
313
  - "--main"
271
- - README.rdoc
314
+ - README.md
272
315
  require_paths:
273
316
  - lib
274
317
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -282,7 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
325
  - !ruby/object:Gem::Version
283
326
  version: '2.2'
284
327
  requirements: []
285
- rubygems_version: 3.6.7
328
+ rubygems_version: 3.6.9
286
329
  specification_version: 4
287
330
  summary: RDoc produces HTML and command-line documentation for Ruby projects
288
331
  test_files: []
data/CONTRIBUTING.rdoc DELETED
@@ -1,219 +0,0 @@
1
- = Developer Introduction
2
-
3
- So you want to write a generator, fix a bug, or otherwise work with RDoc. This
4
- document provides an overview of how RDoc works from parsing options to
5
- generating output. Most of the documentation can be found in the specific
6
- classes for each feature.
7
-
8
- == Bugs
9
-
10
- If you think you found a bug, file a ticket on the {issues
11
- tracker}[https://github.com/ruby/rdoc/issues] on github.
12
-
13
- If your bug involves an error RDoc produced please include a sample file that
14
- illustrates the problem or link to the repository or gem that is associated
15
- with the bug.
16
-
17
- Please include steps to reproduce the issue. Here are some examples of good
18
- issues:
19
-
20
- * https://github.com/ruby/rdoc/issues/55
21
- * https://github.com/ruby/rdoc/issues/61
22
-
23
- == Developer Quick Start
24
-
25
- RDoc uses bundler for development. To get ready to work on RDoc run:
26
-
27
- $ gem install bundler
28
- [...]
29
- $ bundle install
30
- [...]
31
- $ rake
32
- [...]
33
-
34
- This will install all the necessary dependencies for development with rake,
35
- generate documentation and run the tests for the first time.
36
-
37
- If the tests don't pass on the first run check the {GitHub Actions page}[https://github.com/ruby/rdoc/actions] to see if there are any known failures
38
- (there shouldn't be).
39
-
40
- You can now use `rake` and `autotest` to run the tests.
41
-
42
- Note: the `rake` command must be used first before running any tests, because
43
- it's used to generate various parsers implemented in RDoc. Also `rake clean` is
44
- helpful to delete these generated files.
45
-
46
- == Glossary
47
-
48
- Here are definitions for some common terms in the RDoc documentation. The
49
- list also briefly describes how the components of RDoc interact.
50
-
51
- parser::
52
- Parses files and creates a documentation tree from the contents.
53
-
54
- documentation tree::
55
- The documentation tree represents files, classes, modules, methods,
56
- constants, includes, comments and other ruby syntax features as a tree.
57
- RDoc walks this tree with a generator to create documentation.
58
-
59
- generator::
60
- Walks the documentation tree and generates output.
61
-
62
- RDoc ships with two generators, the Darkfish generator creates HTML and the
63
- RI generator creates an RI data store.
64
-
65
- markup parser::
66
- Parses comments from a file into a generic markup tree.
67
-
68
- The markup parsers allow RDoc to handle RDoc, TomDoc, rd and Markdown format
69
- documentation with common formatters.
70
-
71
- markup tree::
72
- Each parsed comment has a markup tree that represents common markup items
73
- such as headings, paragraphs, lists or verbatim text sections for example
74
- code or output.
75
-
76
- A generator uses a formatters to walks the tree to create output. Some
77
- generators use multiple formatters on a markup tree to produce the output.
78
-
79
- formatter::
80
- Converts a parsed markup tree into some form other form of markup.
81
-
82
- Formatters can either produce a one-to-one conversion, such as ToHtml, or
83
- extract part of the parsed result, such as ToHtmlSnippet which outputs the
84
- first 100 characters as HTML.
85
-
86
- == Plugins
87
-
88
- When 'rdoc/rdoc' is loaded RDoc looks for 'rdoc/discover' files in your
89
- installed gems. This can be used to load parsers, alternate generators, or
90
- additional preprocessor directives. An rdoc plugin layout should look
91
- something like this:
92
-
93
- lib/rdoc/discover.rb
94
- lib/my/rdoc/plugin.rb
95
- # etc.
96
-
97
- In your rdoc/discover.rb file you will want to wrap the loading of your plugin
98
- in an RDoc version check like this:
99
-
100
- begin
101
- gem 'rdoc', '~> 3'
102
- require 'my/rdoc/plugin'
103
- rescue Gem::LoadError
104
- end
105
-
106
- === Plugin Types
107
-
108
- In RDoc you can change the following behaviors:
109
-
110
- * Add a parser for a new file format
111
- * Add a new output generator
112
- * Add a new markup directive
113
- * Add a new type of documentation markup
114
- * Add a new type of formatter
115
-
116
- All of these are described below
117
-
118
- == Option Parsing
119
-
120
- Option parsing is handled by RDoc::Options. When you're writing a generator
121
- you can provide the user with extra options by providing a class method
122
- +setup_options+. The option parser will call this after your generator is
123
- loaded. See RDoc::Generator for details.
124
-
125
- == File Parsing
126
-
127
- After options are parsed, RDoc parses files from the files and directories in
128
- ARGV. RDoc compares the filename against what each parser claims it can parse
129
- via RDoc::Parser#parse_files_matching. For example, RDoc::Parser::C can parse
130
- C files, C headers, C++ files, C++ headers and yacc grammars.
131
-
132
- Once a matching parser class is found it is instantiated and +scan+ is called.
133
- The parser needs to extract documentation from the file and add it to the RDoc
134
- document tree. Usually this involves starting at the root and adding a class
135
- or a module (RDoc::TopLevel#add_class and RDoc::TopLevel#add_module) and
136
- proceeding to add classes, modules and methods to each nested item.
137
-
138
- When the parsers are finished the document tree is cleaned up to remove
139
- dangling references to aliases and includes that were not found (and may exist
140
- in a separate library) through RDoc::ClassModule#complete.
141
-
142
- To write your own parser for a new file format see RDoc::Parser.
143
-
144
- === Documentation Tree
145
-
146
- The parsers build a documentation tree that is composed of RDoc::CodeObject and
147
- its subclasses. There are various methods to walk the tree to extract
148
- information, see RDoc::Context and its subclasses.
149
-
150
- Within a class or module, attributes, methods and constants are divided into
151
- sections. The section represents a functional grouping of parts of the class.
152
- TomDoc uses the sections "Public", "Internal" and "Deprecated". The sections
153
- can be enumerated using RDoc::Context#each_section.
154
-
155
- == Output Generation
156
-
157
- An RDoc generator turns the documentation tree into some other kind of output.
158
- RDoc comes with an HTML generator (RDoc::Generator::Darkfish) and an RI
159
- database generator (RDoc::Generator::RI). The output a generator creates does
160
- not have to be human-readable.
161
-
162
- To create your own generator see RDoc::Generator.
163
-
164
- === Comments
165
-
166
- In RDoc 3.10 and newer the comment on an RDoc::CodeObject is now an
167
- RDoc::Comment object instead of a String. This is to support various
168
- documentation markup formats like rdoc, TomDoc and rd. The comments are
169
- normalized to remove comment markers and remove indentation then parsed lazily
170
- via RDoc::Comment#document to create a generic markup tree that can be
171
- processed by a formatter.
172
-
173
- To add your own markup format see RDoc::Markup@Other+directives
174
-
175
- ==== Formatters
176
-
177
- To transform a comment into some form of output an RDoc::Markup::Formatter
178
- subclass is used like RDoc::Markup::ToHtml. A formatter is a visitor that
179
- walks a parsed comment tree (an RDoc::Markup::Document) of any format. To help
180
- write a formatter RDoc::Markup::FormatterTestCase exists for generic parsers,
181
- and RDoc::Markup::TextFormatterTestCase which contains extra test cases for
182
- text-type output (like +ri+ output).
183
-
184
- RDoc ships with formatters that will turn a comment into HTML, rdoc-markup-like
185
- text, ANSI or terminal backspace highlighted text, HTML, cross-referenced HTML,
186
- an HTML snippet free of most markup, an HTML label for use in id attributes, a
187
- table-of-contents page, and text with only code blocks.
188
-
189
- The output of the formatter does not need to be text or text-like.
190
- RDoc::Markup::ToLabel creates an HTML-safe label for use in an HTML id
191
- attribute. A formatter could count the number of words and the average word
192
- length for a comment, for example.
193
-
194
- ==== Directives
195
-
196
- For comments in markup you can add new directives (:nodoc: is a directive).
197
- Directives may replace text or store it off for later use.
198
-
199
- See RDoc::Markup::PreProcess::register for details.
200
-
201
- === JSONIndex
202
-
203
- RDoc contains a special generator, RDoc::Generator::JSONIndex, which creates a
204
- JSON-based search index and includes a search engine for use with HTML output.
205
- This generator can be used to add searching to any HTML output and is designed
206
- to be called from inside an HTML generator.
207
-
208
- == Markup
209
-
210
- Additional documentation markup formats can be added to RDoc. A markup
211
- parsing class must respond to \::parse and accept a String argument containing
212
- the markup format. An RDoc::Document containing documentation items
213
- (RDoc::Markup::Heading, RDoc::Markup::Paragraph, RDoc::Markup::Verbatim, etc.)
214
- must be returned.
215
-
216
- To register the parser with rdoc, add the markup type's name and class to the
217
- RDoc::Text::MARKUP_FORMAT hash like:
218
-
219
- RDoc::Text::MARKUP_FORMAT['rdoc'] = RDoc::Markup
data/README.rdoc DELETED
@@ -1,144 +0,0 @@
1
- = \RDoc - Ruby Documentation System
2
-
3
- home :: https://github.com/ruby/rdoc
4
- rdoc :: https://ruby.github.io/rdoc
5
- bugs :: https://github.com/ruby/rdoc/issues
6
- code quality :: https://codeclimate.com/github/ruby/rdoc
7
-
8
- == Description
9
-
10
- RDoc produces HTML and command-line documentation for Ruby projects. RDoc
11
- includes the +rdoc+ and +ri+ tools for generating and displaying documentation
12
- from the command-line.
13
-
14
- == Generating Documentation
15
-
16
- Once installed, you can create documentation using the +rdoc+ command
17
-
18
- $ rdoc [options] [names...]
19
-
20
- For an up-to-date option summary, type
21
-
22
- $ rdoc --help
23
-
24
- A typical use might be to generate documentation for a package of Ruby
25
- source (such as RDoc itself).
26
-
27
- $ rdoc
28
-
29
- This command generates documentation for all the Ruby and C source
30
- files in and below the current directory. These will be stored in a
31
- documentation tree starting in the subdirectory +doc+.
32
-
33
- You can make this slightly more useful for your readers by having the
34
- index page contain the documentation for the primary file. In our
35
- case, we could type
36
-
37
- % rdoc --main README.rdoc
38
-
39
- You'll find information on the various formatting tricks you can use
40
- in comment blocks in the documentation this generates.
41
-
42
- RDoc uses file extensions to determine how to process each file. File names
43
- ending +.rb+ and +.rbw+ are assumed to be Ruby source. Files
44
- ending +.c+ are parsed as C files. All other files are assumed to
45
- contain just Markup-style markup (with or without leading '#' comment
46
- markers). If directory names are passed to RDoc, they are scanned
47
- recursively for C and Ruby source files only.
48
-
49
- To generate documentation using +rake+ see RDoc::Task[https://ruby.github.io/rdoc/RDoc/Task.html].
50
-
51
- To generate documentation programmatically:
52
-
53
- gem 'rdoc'
54
- require 'rdoc/rdoc'
55
-
56
- options = RDoc::Options.new
57
- options.files = ['a.rb', 'b.rb']
58
- options.setup_generator 'darkfish'
59
- # see RDoc::Options
60
-
61
- rdoc = RDoc::RDoc.new
62
- rdoc.document options
63
- # see RDoc::RDoc
64
-
65
- You can specify the target files for document generation with +.document+ file in the project root directory.
66
- +.document+ file contains a list of file and directory names including comment lines starting with '#'.
67
- See https://github.com/ruby/rdoc/blob/master/.document as an example.
68
-
69
- == Writing Documentation
70
-
71
- To write documentation for RDoc place a comment above the class, module,
72
- method, constant, or attribute you want documented:
73
-
74
- ##
75
- # This class represents an arbitrary shape by a series of points.
76
-
77
- class Shape
78
-
79
- ##
80
- # Creates a new shape described by a +polyline+.
81
- #
82
- # If the +polyline+ does not end at the same point it started at the
83
- # first pointed is copied and placed at the end of the line.
84
- #
85
- # An ArgumentError is raised if the line crosses itself, but shapes may
86
- # be concave.
87
-
88
- def initialize polyline
89
- # ...
90
- end
91
-
92
- end
93
-
94
- The default comment markup format is the RDoc::Markup format.
95
- TomDoc[rdoc-ref:RDoc::TomDoc], Markdown[rdoc-ref:RDoc::Markdown] and
96
- RD[rdoc-ref:RDoc::RD] format comments are also supported. You can set the
97
- default comment format for your entire project by creating a
98
- <tt>.rdoc_options</tt> file. See RDoc::Options@Saved+Options for instructions
99
- on creating one. You can also set the comment format for a single file
100
- through the +:markup:+ directive, but this is only recommended if you wish to
101
- switch markup formats. See RDoc::Markup@Other+directives.
102
-
103
- Comments can contain directives that tell RDoc information that it cannot
104
- otherwise discover through parsing. See RDoc::Markup@Directives to control
105
- what is or is not documented, to define method arguments or to break up
106
- methods in a class by topic. See RDoc::Parser::Ruby for directives used to
107
- teach RDoc about metaprogrammed methods.
108
-
109
- See RDoc::Parser::C for documenting C extensions with RDoc.
110
-
111
- To determine how well your project is documented run <tt>rdoc -C lib</tt> to
112
- get a documentation coverage report. <tt>rdoc -C1 lib</tt> includes parameter
113
- names in the documentation coverage report.
114
-
115
- == Theme Options
116
-
117
- There are a few community-maintained themes for \RDoc:
118
-
119
- - rorvswild-theme-rdoc[https://github.com/BaseSecrete/rorvswild-theme-rdoc]
120
- - hanna[https://github.com/jeremyevans/hanna] (a fork maintained by {Jeremy Evans}[https://github.com/jeremyevans])
121
-
122
- Please follow the theme's README for usage instructions.
123
-
124
- == Bugs
125
-
126
- See CONTRIBUTING.rdoc for information on filing a bug report. It's OK to file
127
- a bug report for anything you're having a problem with. If you can't figure
128
- out how to make RDoc produce the output you like that is probably a
129
- documentation bug.
130
-
131
- == License
132
-
133
- RDoc is Copyright (c) 2001-2003 Dave Thomas, The Pragmatic Programmers.
134
- Portions (c) 2007-2011 Eric Hodel. Portions copyright others, see individual
135
- files and LEGAL.rdoc for details.
136
-
137
- RDoc is free software, and may be redistributed under the terms specified in
138
- LICENSE.rdoc.
139
-
140
- == Warranty
141
-
142
- This software is provided "as is" and without any express or implied
143
- warranties, including, without limitation, the implied warranties of
144
- merchantability and fitness for a particular purpose.