rdoc 6.15.1 → 7.1.0

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 (88) 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 +90 -7
  6. data/doc/markup_reference/markdown.md +558 -0
  7. data/doc/markup_reference/rdoc.rdoc +1169 -0
  8. data/lib/rdoc/code_object/any_method.rb +15 -7
  9. data/lib/rdoc/code_object/class_module.rb +62 -11
  10. data/lib/rdoc/code_object/constant.rb +9 -0
  11. data/lib/rdoc/code_object/context/section.rb +20 -1
  12. data/lib/rdoc/code_object/method_attr.rb +13 -1
  13. data/lib/rdoc/code_object/top_level.rb +31 -18
  14. data/lib/rdoc/comment.rb +190 -8
  15. data/lib/rdoc/cross_reference.rb +30 -21
  16. data/lib/rdoc/generator/aliki.rb +183 -0
  17. data/lib/rdoc/generator/darkfish.rb +8 -2
  18. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  19. data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  20. data/lib/rdoc/generator/template/aliki/_head.rhtml +158 -0
  21. data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  22. data/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  23. data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  24. data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  25. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +25 -0
  26. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +25 -0
  27. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  28. data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  29. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  30. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  31. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  32. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  33. data/lib/rdoc/generator/template/aliki/class.rhtml +220 -0
  34. data/lib/rdoc/generator/template/aliki/css/rdoc.css +1963 -0
  35. data/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  36. data/lib/rdoc/generator/template/aliki/js/aliki.js +505 -0
  37. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  38. data/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
  39. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  40. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  41. data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  42. data/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  43. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  44. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  45. data/lib/rdoc/generator/template/darkfish/_head.rhtml +2 -7
  46. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +1 -1
  47. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -0
  48. data/lib/rdoc/generator/template/darkfish/class.rhtml +11 -11
  49. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +19 -0
  50. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +1 -1
  51. data/lib/rdoc/generator/template/json_index/js/searcher.js +5 -1
  52. data/lib/rdoc/generator.rb +1 -0
  53. data/lib/rdoc/markdown.kpeg +1 -5
  54. data/lib/rdoc/markdown.rb +1 -5
  55. data/lib/rdoc/markup/attribute_manager.rb +28 -1
  56. data/lib/rdoc/markup/blank_line.rb +25 -23
  57. data/lib/rdoc/markup/element.rb +21 -0
  58. data/lib/rdoc/markup/hard_break.rb +30 -27
  59. data/lib/rdoc/markup/heading.rb +166 -77
  60. data/lib/rdoc/markup/pre_process.rb +34 -10
  61. data/lib/rdoc/markup/raw.rb +52 -55
  62. data/lib/rdoc/markup/table.rb +48 -40
  63. data/lib/rdoc/markup/to_ansi.rb +4 -0
  64. data/lib/rdoc/markup/to_bs.rb +4 -0
  65. data/lib/rdoc/markup/to_html.rb +37 -15
  66. data/lib/rdoc/markup/to_html_crossref.rb +24 -5
  67. data/lib/rdoc/markup/to_label.rb +11 -1
  68. data/lib/rdoc/markup/to_rdoc.rb +11 -3
  69. data/lib/rdoc/markup/verbatim.rb +1 -1
  70. data/lib/rdoc/markup.rb +3 -2
  71. data/lib/rdoc/options.rb +21 -10
  72. data/lib/rdoc/parser/c.rb +15 -46
  73. data/lib/rdoc/parser/changelog.rb +8 -0
  74. data/lib/rdoc/parser/prism_ruby.rb +121 -113
  75. data/lib/rdoc/parser/ruby.rb +8 -8
  76. data/lib/rdoc/parser/ruby_tools.rb +5 -7
  77. data/lib/rdoc/parser/simple.rb +4 -21
  78. data/lib/rdoc/rdoc.rb +1 -0
  79. data/lib/rdoc/rubygems_hook.rb +3 -3
  80. data/lib/rdoc/text.rb +16 -1
  81. data/lib/rdoc/token_stream.rb +17 -9
  82. data/lib/rdoc/tom_doc.rb +1 -1
  83. data/lib/rdoc/version.rb +1 -1
  84. data/rdoc.gemspec +3 -3
  85. metadata +36 -9
  86. data/CONTRIBUTING.rdoc +0 -219
  87. data/ExampleMarkdown.md +0 -39
  88. data/ExampleRDoc.rdoc +0 -210
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed79e2cda1c5cd7113829e3fcfbbece5c1d5332e9046778c2581d28059afd9e7
4
- data.tar.gz: cc77a3249231ee94df7d06090d9a683e0c7f71f5924186e2f0dcae5b01ec5b74
3
+ metadata.gz: c14913bad669603f9b9662966297c2e33b45af4500c9cd71bbff067da334ee1a
4
+ data.tar.gz: 4e40f1f5b579891945cc7e365bf3977863eb9236eb9af872d870cb46317d191b
5
5
  SHA512:
6
- metadata.gz: 43bd516f9ffb4f33e76c6186c8b0429525d4729172a25de895a2f1d69f7c523bdc8868c42dc55dc17863f6daa927a56d1aaefbb9edc5519a4885f2a5b60e0cbf
7
- data.tar.gz: 368780ba1a40869aa6a26e2a5734d13bb5ec25e4d47dcea78cb0de2c117bad7b8e964ea69b857aadc799f492f72d51a7d68a7259f357c2d23c9a13064c33ce3b
6
+ metadata.gz: 3aadc0477ea9dd400c1128c512352745b7835171f998c89a83a2827190a41e171d6fa5b89e5c9a27da0bab76fa5492236f7ce13d59ce64970cd414abd9da806c
7
+ data.tar.gz: a6949c4950b1fd69c8176330e1c6bedb4912281521f31f66d36b123e912d7fe2bf4736cfd0dae22ac8de939badd817bbd771f500bbc65f8041ab7939d43a3e14
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,196 @@
1
+ # Contributing to RDoc
2
+
3
+ Thank you for your interest in contributing to RDoc! This document provides guidelines and instructions for contributing.
4
+
5
+ ## Reporting Bugs
6
+
7
+ If you think you found a bug, open an issue on the [issue tracker](https://github.com/ruby/rdoc/issues) on GitHub.
8
+
9
+ When reporting a bug:
10
+
11
+ - Include a sample file that illustrates the problem, or link to the repository/gem associated with the bug
12
+ - Include steps to reproduce the issue
13
+
14
+ ## Development Setup
15
+
16
+ RDoc uses Bundler for development. To get started:
17
+
18
+ ```bash
19
+ bundle install
20
+ bundle exec rake
21
+ ```
22
+
23
+ This will install dependencies and run the tests.
24
+
25
+ If you're working on CSS or templates, you'll also want Node dependencies for the CSS linter:
26
+
27
+ ```bash
28
+ npm install
29
+ ```
30
+
31
+ If 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.
32
+
33
+ **Note:** Generated parser files are committed to the repository. If you delete them (for example via `bundle exec rake clean`) or you change any `.ry`/`.kpeg` parser sources, run `bundle exec rake generate` before running tests.
34
+
35
+ ## Running Tests
36
+
37
+ ```bash
38
+ # Run all tests (default task)
39
+ bundle exec rake
40
+
41
+ # Run unit tests only (excludes RubyGems integration)
42
+ bundle exec rake normal_test
43
+
44
+ # Run RubyGems integration tests only
45
+ bundle exec rake rubygems_test
46
+
47
+ # Verify generated parser files are current (CI check)
48
+ bundle exec rake verify_generated
49
+ ```
50
+
51
+ - **Test Framework:** [`test-unit`](https://github.com/test-unit/test-unit)
52
+ - **Test Location:** `test/` directory
53
+ - **Test Helper:** `test/lib/helper.rb`
54
+
55
+ ## Linting
56
+
57
+ ### RuboCop (Ruby Code)
58
+
59
+ ```bash
60
+ # Check Ruby code style
61
+ bundle exec rubocop
62
+
63
+ # Auto-fix style issues
64
+ bundle exec rubocop -A
65
+ ```
66
+
67
+ ### Herb Linter (ERB/RHTML Templates)
68
+
69
+ ```bash
70
+ # Lint ERB template files
71
+ npx @herb-tools/linter "**/*.rhtml"
72
+
73
+ # Lint specific directory
74
+ npx @herb-tools/linter "lib/**/*.rhtml"
75
+ ```
76
+
77
+ **Template Location:** `lib/rdoc/generator/template/**/*.rhtml`
78
+
79
+ ### Stylelint (CSS Files)
80
+
81
+ ```bash
82
+ # Lint CSS files
83
+ npm run lint:css
84
+
85
+ # Auto-fix style issues
86
+ npm run lint:css -- --fix
87
+ ```
88
+
89
+ ## Type annotations
90
+
91
+ RDoc is currently not a typed codebase. Despite not running a type checker, contributors have been
92
+ adding some comment annotations to make the codebase easier to navigate and understand.
93
+
94
+ These annotations use [Sorbet flavored RBS](https://sorbet.org/docs/rbs-support) annotations,
95
+ so that we can tag definitions as abstract and override. For more information on RBS syntax,
96
+ see the [documentation](https://github.com/ruby/rbs/blob/master/docs/syntax.md).
97
+
98
+ ## Parser Generation
99
+
100
+ RDoc uses generated parsers for Markdown and RD formats.
101
+
102
+ ```bash
103
+ # Generate all parser files from sources
104
+ bundle exec rake generate
105
+
106
+ # Remove generated parser files
107
+ bundle exec rake clean
108
+
109
+ # Verify generated files are in sync with sources (CI check)
110
+ bundle exec rake verify_generated
111
+ ```
112
+
113
+ **Source Files** (edit these):
114
+
115
+ - `lib/rdoc/rd/block_parser.ry` → generates `block_parser.rb` via racc
116
+ - `lib/rdoc/rd/inline_parser.ry` → generates `inline_parser.rb` via racc
117
+ - `lib/rdoc/markdown.kpeg` → generates `markdown.rb` via kpeg
118
+ - `lib/rdoc/markdown/literals.kpeg` → generates `literals.rb` via kpeg
119
+
120
+ **Important:**
121
+
122
+ - Generated parser files **should be committed** to the repository
123
+ - Do not edit generated `.rb` parser files directly
124
+ - After modifying `.ry` or `.kpeg` source files, run `bundle exec rake generate`
125
+ - CI runs `rake verify_generated` to ensure generated files are in sync with their sources
126
+
127
+ ## Documentation Generation
128
+
129
+ ```bash
130
+ # Generate documentation (creates _site directory)
131
+ bundle exec rake rdoc
132
+
133
+ # Force regenerate documentation
134
+ bundle exec rake rerdoc
135
+
136
+ # Show documentation coverage
137
+ bundle exec rake rdoc:coverage
138
+ bundle exec rake coverage
139
+ ```
140
+
141
+ - **Output Directory:** `_site/` (GitHub Pages compatible)
142
+ - **Configuration:** `.rdoc_options` and `.document`
143
+
144
+ ## Themes
145
+
146
+ RDoc ships with two HTML themes:
147
+
148
+ - **Aliki** (default) - Modern theme with improved styling and navigation
149
+ - **Darkfish** (deprecated) - Classic theme, will be removed in v8.0
150
+
151
+ New feature development should focus on the Aliki theme. Darkfish will continue to receive bug fixes but no new features.
152
+
153
+ Theme templates are located at `lib/rdoc/generator/template/<theme>/`.
154
+
155
+ ## Project Structure
156
+
157
+ ```
158
+ lib/rdoc/
159
+ ├── rdoc.rb # Main entry point (RDoc::RDoc class)
160
+ ├── version.rb # Version constant
161
+ ├── task.rb # Rake task integration
162
+ ├── parser/ # Source code parsers
163
+ │ ├── ruby.rb # Ruby code parser
164
+ │ ├── c.rb # C extension parser
165
+ │ ├── prism_ruby.rb # Prism-based Ruby parser
166
+ │ └── ...
167
+ ├── generator/ # Documentation generators
168
+ │ ├── aliki.rb # HTML generator (default theme)
169
+ │ ├── darkfish.rb # HTML generator (deprecated, will be removed in v8.0)
170
+ │ ├── markup.rb # Markup format generator
171
+ │ ├── ri.rb # RI command generator
172
+ │ └── template/ # ERB templates
173
+ │ ├── aliki/ # Aliki theme (default)
174
+ │ └── darkfish/ # Darkfish theme (deprecated)
175
+ ├── markup/ # Markup parsing and formatting
176
+ ├── code_object/ # AST objects for documented items
177
+ ├── markdown.kpeg # Parser source (edit this)
178
+ ├── markdown.rb # Generated parser (do not edit)
179
+ ├── markdown/ # Markdown parsing
180
+ │ ├── literals.kpeg # Parser source (edit this)
181
+ │ └── literals.rb # Generated parser (do not edit)
182
+ ├── rd/ # RD format parsing
183
+ │ ├── block_parser.ry # Parser source (edit this)
184
+ │ ├── block_parser.rb # Generated parser (do not edit)
185
+ │ ├── inline_parser.ry # Parser source (edit this)
186
+ │ └── inline_parser.rb # Generated parser (do not edit)
187
+ └── ri/ # RI (Ruby Info) tool
188
+
189
+ test/ # Test files
190
+ ├── lib/helper.rb # Test helpers
191
+ └── rdoc/ # Main test directory
192
+ ```
193
+
194
+ ## Code of Conduct
195
+
196
+ Please be respectful and constructive in all interactions. We're all here to make RDoc better!
data/History.rdoc CHANGED
@@ -163,7 +163,7 @@
163
163
  * Moved old DEVELOPERS file to CONTRIBUTING to match github conventions.
164
164
  * TomDoc output now has a "Returns" heading. Issue #234 by Brian Henderson
165
165
  * Metaprogrammed methods can now use the :args: directive in addition to the
166
- :call-seq: directive. Issue #236 by Mike Moore.
166
+ \:call-seq: directive. Issue #236 by Mike Moore.
167
167
  * Sections can be linked to using "@" like labels. If a section and a label
168
168
  have the same name the section will be preferred. Issue #233 by Brian
169
169
  Henderson.
data/LEGAL.rdoc CHANGED
@@ -4,6 +4,12 @@
4
4
 
5
5
  The files in this distribution are covered by the Ruby license (see LICENSE) except the features mentioned below:
6
6
 
7
+ Aliki::
8
+ Aliki was written by Stan Lo and is included under the MIT license.
9
+
10
+ * lib/rdoc/generator/aliki.rb
11
+ * lib/rdoc/generator/template/aliki/*
12
+
7
13
  Darkfish::
8
14
  Darkfish was written by Michael Granger and is included under the BSD 3-Clause
9
15
  license. Darkfish contains images from the Silk Icons set by Mark James.
data/README.md CHANGED
@@ -48,7 +48,7 @@ require 'rdoc/rdoc'
48
48
 
49
49
  options = RDoc::Options.new
50
50
  options.files = ['a.rb', 'b.rb']
51
- options.setup_generator 'darkfish'
51
+ options.setup_generator 'aliki'
52
52
  # see RDoc::Options
53
53
 
54
54
  rdoc = RDoc::RDoc.new
@@ -60,7 +60,7 @@ You can specify the target files for document generation with `.document` file i
60
60
 
61
61
  ## Writing Documentation
62
62
 
63
- To write documentation for RDoc place a comment above the class, module, method, constant, or attribute you want documented:
63
+ To write documentation for RDoc, place a comment above the class, module, method, constant, or attribute you want documented:
64
64
 
65
65
  ```rb
66
66
  ##
@@ -80,17 +80,100 @@ class Shape
80
80
  end
81
81
  ```
82
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.
83
+ ### Markup Formats
84
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.
85
+ RDoc supports multiple markup formats:
86
+
87
+ | Format | File Extensions | Default For |
88
+ |--------|-----------------|-------------|
89
+ | [RDoc](doc/markup_reference/rdoc.rdoc) | `.rdoc` | `.rb`, `.c` files |
90
+ | [Markdown](doc/markup_reference/markdown.md) | `.md` | None |
91
+ | RD | `.rd` | None |
92
+ | TomDoc | N/A | None |
93
+
94
+ **RDoc markup** is currently the default format for Ruby and C files. However, we plan to retire it in favor of Markdown in the future.
95
+
96
+ **Markdown** support is actively being improved. Once it reaches feature parity with RDoc markup, it will become the default format.
97
+
98
+ For standalone documentation files, we recommend writing `.md` files instead of `.rdoc` files.
99
+
100
+ **RD** and **TomDoc** are legacy formats. We highly discourage their use in new projects.
101
+
102
+ ### Specifying Markup Format
103
+
104
+ **Per-file:** Add a `:markup:` directive at the top of a Ruby file:
105
+
106
+ ```ruby
107
+ # :markup: markdown
108
+
109
+ # This class uses **Markdown** for documentation.
110
+ class MyClass
111
+ end
112
+ ```
113
+
114
+ **Per-project:** Create a `.rdoc_options` file in your project root:
115
+
116
+ ```yaml
117
+ markup: markdown
118
+ ```
119
+
120
+ **Command line:**
121
+
122
+ ```bash
123
+ rdoc --markup markdown
124
+ ```
125
+
126
+ ### Feature Differences
127
+
128
+ | Feature | RDoc Markup | Markdown |
129
+ |---------|-------------|----------|
130
+ | Headings | `= Heading` | `# Heading` |
131
+ | Bold | `*word*` | `**word**` |
132
+ | Italic | `_word_` | `*word*` |
133
+ | Monospace | `+word+` | `` `word` `` |
134
+ | Links | `{text}[url]` | `[text](url)` |
135
+ | Code blocks | Indent 2 spaces | Fenced with ``` |
136
+ | Cross-references | Automatic | Automatic |
137
+ | Directives (`:nodoc:`, etc.) | Supported | Supported |
138
+ | Tables | Not supported | Supported |
139
+ | Strikethrough | `<del>text</del>` | `~~text~~` |
140
+ | Footnotes | Not supported | Supported |
141
+
142
+ For complete syntax documentation, see:
143
+
144
+ - [RDoc Markup Reference](doc/markup_reference/rdoc.rdoc)
145
+ - [Markdown Reference](doc/markup_reference/markdown.md)
146
+
147
+ ### Directives
148
+
149
+ 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
150
 
87
151
  See RDoc::Parser::C for documenting C extensions with RDoc.
88
152
 
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.
153
+ ### Documentation Coverage
154
+
155
+ 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
156
 
91
157
  ## Theme Options
92
158
 
93
- There are a few community-maintained themes for RDoc:
159
+ RDoc ships with two built-in themes:
160
+
161
+ - **Aliki** (default) - A modern, clean theme with improved navigation and search
162
+ - **Darkfish** (deprecated) - The classic theme, will be removed in v8.0
163
+
164
+ To use the Darkfish theme instead of the default Aliki theme:
165
+
166
+ ```shell
167
+ rdoc --format darkfish
168
+ ```
169
+
170
+ Or in your `.rdoc_options` file:
171
+
172
+ ```yaml
173
+ generator_name: darkfish
174
+ ```
175
+
176
+ There are also a few community-maintained themes for RDoc:
94
177
 
95
178
  - [rorvswild-theme-rdoc](https://github.com/BaseSecrete/rorvswild-theme-rdoc)
96
179
  - [hanna](https://github.com/jeremyevans/hanna) (a fork maintained by [Jeremy Evans](https://github.com/jeremyevans))
@@ -99,7 +182,7 @@ Please follow the theme's README for usage instructions.
99
182
 
100
183
  ## Bugs
101
184
 
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.
185
+ See [CONTRIBUTING.md](CONTRIBUTING.md) 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
186
 
104
187
  ## License
105
188