yard 0.9.28 → 0.9.43
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +139 -1
- data/LEGAL +29 -1
- data/README.md +29 -25
- data/docs/GettingStarted.md +41 -15
- data/docs/Parser.md +17 -42
- data/docs/Tags.md +6 -6
- data/docs/Templates.md +5 -4
- data/docs/WhatsNew.md +61 -9
- data/docs/templates/default/yard_tags/html/setup.rb +1 -1
- data/lib/yard/autoload.rb +20 -1
- data/lib/yard/cli/command.rb +1 -1
- data/lib/yard/cli/diff.rb +7 -2
- data/lib/yard/cli/yardoc.rb +1 -1
- data/lib/yard/code_objects/base.rb +6 -2
- data/lib/yard/code_objects/extra_file_object.rb +1 -0
- data/lib/yard/code_objects/macro_object.rb +0 -1
- data/lib/yard/code_objects/proxy.rb +1 -1
- data/lib/yard/docstring_parser.rb +1 -2
- data/lib/yard/handlers/base.rb +23 -1
- data/lib/yard/handlers/processor.rb +1 -1
- data/lib/yard/handlers/rbs/attribute_handler.rb +79 -0
- data/lib/yard/handlers/rbs/base.rb +38 -0
- data/lib/yard/handlers/rbs/constant_handler.rb +18 -0
- data/lib/yard/handlers/rbs/method_handler.rb +327 -0
- data/lib/yard/handlers/rbs/mixin_handler.rb +20 -0
- data/lib/yard/handlers/rbs/namespace_handler.rb +26 -0
- data/lib/yard/handlers/ruby/attribute_handler.rb +7 -4
- data/lib/yard/handlers/ruby/constant_handler.rb +24 -6
- data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +1 -1
- data/lib/yard/handlers/ruby/legacy/visibility_handler.rb +2 -1
- data/lib/yard/handlers/ruby/mixin_handler.rb +13 -6
- data/lib/yard/handlers/ruby/visibility_handler.rb +14 -1
- data/lib/yard/i18n/locale.rb +2 -2
- data/lib/yard/i18n/message.rb +2 -2
- data/lib/yard/i18n/messages.rb +1 -1
- data/lib/yard/i18n/pot_generator.rb +2 -2
- data/lib/yard/logging.rb +116 -61
- data/lib/yard/open_struct.rb +67 -0
- data/lib/yard/options.rb +1 -1
- data/lib/yard/parser/rbs/rbs_parser.rb +325 -0
- data/lib/yard/parser/rbs/statement.rb +75 -0
- data/lib/yard/parser/ruby/ast_node.rb +5 -4
- data/lib/yard/parser/ruby/legacy/irb/slex.rb +19 -1
- data/lib/yard/parser/ruby/legacy/ruby_lex.rb +20 -5
- data/lib/yard/parser/ruby/ruby_parser.rb +117 -26
- data/lib/yard/parser/source_parser.rb +7 -7
- data/lib/yard/registry_resolver.rb +9 -1
- data/lib/yard/rubygems/specification.rb +1 -1
- data/lib/yard/server/commands/base.rb +2 -2
- data/lib/yard/server/commands/library_command.rb +8 -8
- data/lib/yard/server/commands/static_file_helpers.rb +1 -2
- data/lib/yard/server/http_utils.rb +512 -0
- data/lib/yard/server/library_version.rb +1 -1
- data/lib/yard/server/rack_adapter.rb +13 -5
- data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +168 -88
- data/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js +203 -12
- data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +1 -17
- data/lib/yard/server/templates/default/method_details/html/permalink.erb +4 -2
- data/lib/yard/server/templates/doc_server/library_list/html/headers.erb +3 -3
- data/lib/yard/server/templates/doc_server/library_list/html/library_list.erb +2 -3
- data/lib/yard/server/templates/doc_server/processing/html/processing.erb +22 -16
- data/lib/yard/tags/default_factory.rb +1 -0
- data/lib/yard/tags/directives.rb +7 -1
- data/lib/yard/tags/library.rb +3 -3
- data/lib/yard/tags/overload_tag.rb +2 -1
- data/lib/yard/tags/tag.rb +4 -3
- data/lib/yard/tags/types_explainer.rb +6 -5
- data/lib/yard/templates/engine.rb +0 -1
- data/lib/yard/templates/helpers/base_helper.rb +1 -1
- data/lib/yard/templates/helpers/html_helper.rb +21 -6
- data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +6 -1
- data/lib/yard/templates/helpers/markup/hybrid_markdown.rb +2147 -0
- data/lib/yard/templates/helpers/markup/rdoc_markup.rb +2 -0
- data/lib/yard/templates/helpers/markup_helper.rb +4 -2
- data/lib/yard/templates/template_options.rb +0 -1
- data/lib/yard/version.rb +1 -1
- data/po/ja.po +101 -101
- data/templates/default/fulldoc/html/css/common.css +1 -1
- data/templates/default/fulldoc/html/css/full_list.css +201 -53
- data/templates/default/fulldoc/html/css/style.css +991 -399
- data/templates/default/fulldoc/html/frames.erb +9 -4
- data/templates/default/fulldoc/html/full_list.erb +8 -5
- data/templates/default/fulldoc/html/js/app.js +799 -312
- data/templates/default/fulldoc/html/js/full_list.js +332 -214
- data/templates/default/fulldoc/html/setup.rb +10 -2
- data/templates/default/layout/html/headers.erb +1 -1
- data/templates/default/layout/html/layout.erb +3 -1
- data/templates/default/method/html/header.erb +3 -3
- data/templates/default/module/html/defines.erb +3 -3
- data/templates/default/module/html/inherited_methods.erb +1 -0
- data/templates/default/module/html/method_summary.erb +8 -0
- data/templates/default/module/setup.rb +20 -0
- data/templates/default/onefile/html/headers.erb +2 -0
- data/templates/default/onefile/html/layout.erb +3 -4
- data/templates/default/tags/html/example.erb +2 -2
- data/templates/default/tags/html/option.erb +1 -1
- data/templates/guide/fulldoc/html/css/style.css +347 -97
- data/templates/guide/fulldoc/html/js/app.js +61 -33
- data/templates/guide/layout/html/layout.erb +69 -72
- metadata +21 -60
- data/.dockerignore +0 -2
- data/.gitattributes +0 -4
- data/.github/FUNDING.yml +0 -3
- data/.github/ISSUE_TEMPLATE.md +0 -33
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -12
- data/.github/workflows/ci.yml +0 -30
- data/.github/workflows/gem.yml +0 -19
- data/.gitignore +0 -14
- data/.rspec +0 -2
- data/.rubocop.yml +0 -112
- data/CODE_OF_CONDUCT.md +0 -15
- data/CONTRIBUTING.md +0 -140
- data/Dockerfile.samus +0 -28
- data/Gemfile +0 -34
- data/Rakefile +0 -36
- data/SECURITY.md +0 -26
- data/benchmarks/builtins_vs_eval.rb +0 -24
- data/benchmarks/concat_vs_join.rb +0 -13
- data/benchmarks/erb_vs_erubis.rb +0 -54
- data/benchmarks/format_args.rb +0 -47
- data/benchmarks/generation.rb +0 -38
- data/benchmarks/marshal_vs_dbm.rb +0 -64
- data/benchmarks/parsing.rb +0 -46
- data/benchmarks/pathname_vs_string.rb +0 -51
- data/benchmarks/rdoc_vs_yardoc.rb +0 -11
- data/benchmarks/registry_store_types.rb +0 -49
- data/benchmarks/ri_vs_yri.rb +0 -19
- data/benchmarks/ripper_parser.rb +0 -13
- data/benchmarks/splat_vs_flatten.rb +0 -13
- data/benchmarks/template_erb.rb +0 -23
- data/benchmarks/template_format.rb +0 -7
- data/benchmarks/template_profile.rb +0 -18
- data/benchmarks/yri_cache.rb +0 -20
- data/samus.json +0 -49
- data/tasks/prepare_tag.rake +0 -45
- data/tasks/update_error_map.rake +0 -53
- data/yard.gemspec +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 92d411c4d39cc74df916cbac8719ebd7ac6ed1fb17b37022148f584440bda554
|
|
4
|
+
data.tar.gz: 9582c48d6c1949c055e22035f325abc957ec31900613f5b04307f7f27fc011a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d566d6989e868b3bc4959037309c9c07a89608f07a39ad2719ead8765fca6ab3ae6240bfe7d56394ad47c8d75c5999d02313f6f7eaedb056a2ea584750d15cc1
|
|
7
|
+
data.tar.gz: 641e462842732b47a67ff95eda6cfdb0373de7b2f487ceb7aa827815c0f8201fa55639979f7df17ec4d12864de60c4cc631fc7921cc787b20a04f5493cd86033
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,143 @@
|
|
|
1
1
|
# main
|
|
2
2
|
|
|
3
|
+
# [0.9.43] - April 17th, 2026
|
|
4
|
+
|
|
5
|
+
[0.9.43]: https://github.com/lsegal/yard/compare/v0.9.42...v0.9.43
|
|
6
|
+
|
|
7
|
+
- Fix attribute registration in .rbs files (#1583)
|
|
8
|
+
|
|
9
|
+
# [0.9.42] - April 16th, 2026
|
|
10
|
+
|
|
11
|
+
[0.9.42]: https://github.com/lsegal/yard/compare/v0.9.41...v0.9.42
|
|
12
|
+
|
|
13
|
+
- Fix alternating rows when loading a module in default HTML templates with subelements in the nav frame
|
|
14
|
+
- Fix reliability of keypresses and copy/paste in search box (#1174)
|
|
15
|
+
- Fix regression in `yard server` search box styling
|
|
16
|
+
- Fix possible path traversal with document_root (`--docroot`) set in `yard server` ([GHSA-xfhh-rx56-rxcr](https://github.com/lsegal/yard/security/advisories/GHSA-xfhh-rx56-rxcr))
|
|
17
|
+
|
|
18
|
+
# [0.9.41] - April 14th, 2026
|
|
19
|
+
|
|
20
|
+
[0.9.41]: https://github.com/lsegal/yard/compare/v0.9.40...v0.9.41
|
|
21
|
+
|
|
22
|
+
- Add support for `rdoc-image:...` syntax in HybridMarkup (#1676)
|
|
23
|
+
- Add support for colon suffix code blocks in HybridMarkup (rdoc compatibility)
|
|
24
|
+
- Fix responsiveness and state issues with nav frame links in `yard server`
|
|
25
|
+
|
|
26
|
+
# [0.9.40] - April 12th, 2026
|
|
27
|
+
|
|
28
|
+
[0.9.40]: https://github.com/lsegal/yard/compare/v0.9.39...v0.9.40
|
|
29
|
+
|
|
30
|
+
- Add support for Ruby .rbs files (docstrings included) (#1673)
|
|
31
|
+
- Add built-in hybrid RDoc/Markdown renderer (`HybridMarkdown`) requiring no external gems (#1674)
|
|
32
|
+
- Add support for `#-` as a comment-block separator. See Getting Started Guide.
|
|
33
|
+
- Add support for `commonmarker` version `>= 1.0`.
|
|
34
|
+
- Remove usage of jQuery in default templates. jQuery library is still packaged in templates for backward compatibility (#1675)
|
|
35
|
+
- Fix false self-referential mixin when bare name matches ancestor namespace (#1672)
|
|
36
|
+
- Fix bracket/brace map corruption from Ruby 3.0+ pattern matching deconstruction (#1671)
|
|
37
|
+
- Fix `@!scope class` on attributes (#1582, #1655, #1666)
|
|
38
|
+
- Fix `@!parse` directives not including source for block (#1665)
|
|
39
|
+
- Fix inherited methods not appearing in groups (#1656)
|
|
40
|
+
|
|
41
|
+
# [0.9.39] - April 8th, 2026
|
|
42
|
+
|
|
43
|
+
[0.9.39]: https://github.com/lsegal/yard/compare/v0.9.38...v0.9.39
|
|
44
|
+
|
|
45
|
+
- Add support for Ruby 4.0 (#1663)
|
|
46
|
+
- Add changelog URI to gemspec metadata (#1641)
|
|
47
|
+
- Fix issues with source ranges (#1642)
|
|
48
|
+
- Fix an issue loading relative links from file list in HTML template (#1660)
|
|
49
|
+
- Various test fixes (#1650, #1651)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# [0.9.38] - December 5th, 2025
|
|
53
|
+
|
|
54
|
+
[0.9.38]: https://github.com/lsegal/yard/compare/v0.9.37...v0.9.38
|
|
55
|
+
|
|
56
|
+
- Add support for complex constant assignment (#1599)
|
|
57
|
+
- Add support for Data type structs (#1600)
|
|
58
|
+
- Support multi method duck type syntax in type explainer (#1631)
|
|
59
|
+
- Improve Ruby 3.5 compatibility (#1616)
|
|
60
|
+
- Update documentation for various type annotations (#1615)
|
|
61
|
+
- JavaScript frontend updates (resizer, JS bugs, reduce console verbosity) for default template
|
|
62
|
+
- Fix beginless/endless range errors (#1549, #1625)
|
|
63
|
+
- Fix path structure in Templates.md documentation (#1588)
|
|
64
|
+
- Fix signature handling in overload (#1590)
|
|
65
|
+
- Fix handling of **nil with named block (#1623)
|
|
66
|
+
- Fix directives in empty class bodies (#1624)
|
|
67
|
+
- Fix parsing of array within array syntax (#1604)
|
|
68
|
+
- Fix parsing of visibility keywords in front of class methods (#1632)
|
|
69
|
+
|
|
70
|
+
# [0.9.37] - September 4th, 2024
|
|
71
|
+
|
|
72
|
+
[0.9.37]: https://github.com/lsegal/yard/compare/v0.9.36...v0.9.37
|
|
73
|
+
|
|
74
|
+
- Fix JavaScript errors in `--one-file` template (#1426)
|
|
75
|
+
- Fix heredoc parsing and add support for squiggly heredocs (#1315, #1495)
|
|
76
|
+
- Accessibility improvements to the default template (#1501)
|
|
77
|
+
- Improved YARD documentation (#1410, #1512, #1516, #1544)
|
|
78
|
+
- Fix error when parsing `@option` tags (#1515)
|
|
79
|
+
- Fix issue parsing UTF-8 filenames (#1517)
|
|
80
|
+
- Replace OpenStruct with optimized YARD::OpenStruct to avoid ostruct performance warnings (#1545)
|
|
81
|
+
- Add support for `private attr_*` syntax (#1541)
|
|
82
|
+
- Remove logger dependency (#1546)
|
|
83
|
+
|
|
84
|
+
# [0.9.36] - February 29th, 2024
|
|
85
|
+
|
|
86
|
+
[0.9.36]: https://github.com/lsegal/yard/compare/v0.9.35...v0.9.36
|
|
87
|
+
|
|
88
|
+
- Further XSS fixes for generated frameset pages (#1538)
|
|
89
|
+
- Improve tests for Ruby 3.3 compatibility (#1519, #1531)
|
|
90
|
+
- Documentation improvements (#1524)
|
|
91
|
+
|
|
92
|
+
# [0.9.35] - February 28th, 2024
|
|
93
|
+
|
|
94
|
+
[0.9.35]: https://github.com/lsegal/yard/compare/v0.9.34...v0.9.35
|
|
95
|
+
|
|
96
|
+
- Fix possible XSS on generated YARD frameset pages (thanks to @RedYetiDev for finding and patching) (2069e2b).
|
|
97
|
+
- Fix errors when using `@option` on non-method objects (#1508)
|
|
98
|
+
- Support Ruby 3.3 changes in Ripper parser (#1510)
|
|
99
|
+
|
|
100
|
+
# [0.9.34] - April 12nd, 2023
|
|
101
|
+
|
|
102
|
+
[0.9.34]: https://github.com/lsegal/yard/compare/v0.9.33...v0.9.34
|
|
103
|
+
|
|
104
|
+
- Add changelog to yard.gemspec
|
|
105
|
+
- Fix fork behavior in `yard server --fork`
|
|
106
|
+
|
|
107
|
+
# [0.9.33] - April 11st, 2023
|
|
108
|
+
|
|
109
|
+
[0.9.33]: https://github.com/lsegal/yard/compare/v0.9.32...v0.9.33
|
|
110
|
+
|
|
111
|
+
- Ensure .yardopts is present in gem package (internal YARD documentation change)
|
|
112
|
+
|
|
113
|
+
# 0.9.32 - April 9th, 2023
|
|
114
|
+
|
|
115
|
+
[0.9.32]: https://github.com/lsegal/yard/compare/v0.9.31...v0.9.32
|
|
116
|
+
|
|
117
|
+
- Fix issue with custom Rack::Request attributes in `yard server`
|
|
118
|
+
|
|
119
|
+
# [0.9.31] - April 9th, 2023
|
|
120
|
+
|
|
121
|
+
[0.9.31]: https://github.com/lsegal/yard/compare/v0.9.30...v0.9.31
|
|
122
|
+
|
|
123
|
+
- Remove dependency on webrick in YARD::Server::Commands::StaticFileHelpers
|
|
124
|
+
|
|
125
|
+
# [0.9.30] - April 9th, 2023
|
|
126
|
+
|
|
127
|
+
[0.9.30]: https://github.com/lsegal/yard/compare/v0.9.29...v0.9.30
|
|
128
|
+
|
|
129
|
+
- Hot release fix to correct issue with gem packaging missing templates (#1490)
|
|
130
|
+
|
|
131
|
+
# [0.9.29] - April 8th, 2023
|
|
132
|
+
|
|
133
|
+
[0.9.29]: https://github.com/lsegal/yard/compare/v0.9.28...v0.9.29
|
|
134
|
+
|
|
135
|
+
- Enable table support for CommonMarker (#1443)
|
|
136
|
+
- Parser performance improvements (#1452, #1453, #1454, #1455)
|
|
137
|
+
- Fix autoload of RipperParser (#1460)
|
|
138
|
+
- Remove dependency on webrick for better Ruby 3.1+ support
|
|
139
|
+
- Improvements for mixin resolution (#1467, #1468)
|
|
140
|
+
|
|
3
141
|
# [0.9.28] - June 1st, 2022
|
|
4
142
|
|
|
5
143
|
[0.9.28]: https://github.com/lsegal/yard/compare/v0.9.27...v0.9.28
|
|
@@ -758,7 +896,7 @@ contributions to this version.
|
|
|
758
896
|
|
|
759
897
|
[0.4.0]: https://github.com/lsegal/yard/compare/v0.2.3.5...v0.4.0
|
|
760
898
|
|
|
761
|
-
- Added new templating engine based on [tadpole](
|
|
899
|
+
- Added new templating engine based on [tadpole](https://github.com/lsegal/tadpole)
|
|
762
900
|
- Added YARD queries (`--query` CLI argument to yardoc)
|
|
763
901
|
- Greatly expanded YARD documentation
|
|
764
902
|
- Added plugin support
|
data/LEGAL
CHANGED
|
@@ -4,7 +4,7 @@ LEGAL NOTICE INFORMATION
|
|
|
4
4
|
All the files in this distribution are covered under either the MIT
|
|
5
5
|
license (see the file LICENSE) except some files mentioned below.
|
|
6
6
|
|
|
7
|
-
lib/parser/ruby/legacy/ruby_lex.rb:
|
|
7
|
+
lib/yard/parser/ruby/legacy/ruby_lex.rb:
|
|
8
8
|
|
|
9
9
|
This file is under the Ruby license. YARD uses a modified version of it.
|
|
10
10
|
|
|
@@ -64,3 +64,31 @@ lib/parser/ruby/legacy/ruby_lex.rb:
|
|
|
64
64
|
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
65
65
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
66
66
|
PURPOSE.
|
|
67
|
+
|
|
68
|
+
lib/yard/server/http_utils.rb:
|
|
69
|
+
|
|
70
|
+
This file is vendored and slightly modified from WEBrick because it was
|
|
71
|
+
removed from Ruby core in Ruby 3.x.
|
|
72
|
+
|
|
73
|
+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
|
|
74
|
+
|
|
75
|
+
Redistribution and use in source and binary forms, with or without
|
|
76
|
+
modification, are permitted provided that the following conditions
|
|
77
|
+
are met:
|
|
78
|
+
1. Redistributions of source code must retain the above copyright
|
|
79
|
+
notice, this list of conditions and the following disclaimer.
|
|
80
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
81
|
+
notice, this list of conditions and the following disclaimer in the
|
|
82
|
+
documentation and/or other materials provided with the distribution.
|
|
83
|
+
|
|
84
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
85
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
86
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
87
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
88
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
89
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
90
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
91
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
92
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
93
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
94
|
+
SUCH DAMAGE.
|
data/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# YARD: Yay! A Ruby Documentation Tool
|
|
2
2
|
|
|
3
|
-
[](
|
|
4
|
-
[](
|
|
5
|
-
[](
|
|
3
|
+
[](https://yardoc.org)
|
|
4
|
+
[](https://github.com/lsegal/yard)
|
|
5
|
+
[](https://rubydoc.org/gems/yard/frames)
|
|
6
6
|
|
|
7
|
-
[](
|
|
7
|
+
[](https://github.com/lsegal/yard/releases)
|
|
8
8
|
[](https://github.com/lsegal/yard/actions/workflows/ci.yml)
|
|
9
9
|
[](https://coveralls.io/github/lsegal/yard)
|
|
10
10
|
[](#license)
|
|
@@ -19,10 +19,10 @@ summary of some of YARD's notable features.
|
|
|
19
19
|
|
|
20
20
|
## Feature List
|
|
21
21
|
|
|
22
|
-
**1. RDoc/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
**1. Builtin RDoc/Markdown Hybrid Support**: YARD ships with a builtin markup
|
|
23
|
+
renderer that supports both RDoc and Markdown formatting out of the box—no
|
|
24
|
+
external gem required. You can freely mix RDoc-style and Markdown-style
|
|
25
|
+
documentation without installing any additional libraries.
|
|
26
26
|
|
|
27
27
|
**2. Yardoc Meta-tag Formatting Like Python, Java, Objective-C and other
|
|
28
28
|
languages**: YARD uses a '@tag' style definition syntax for meta tags alongside
|
|
@@ -114,20 +114,24 @@ $ gem install yard
|
|
|
114
114
|
Alternatively, if you've checked the source out directly, you can call
|
|
115
115
|
`rake install` from the root project directory.
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
install lacks RDoc, which is occasionally used by YARD to convert markup to
|
|
119
|
-
HTML. If running `which rdoc` turns up empty, install RDoc by issuing:
|
|
117
|
+
### Markup rendering
|
|
120
118
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
YARD includes a builtin renderer that handles both RDoc and Markdown markup
|
|
120
|
+
types without any external dependencies. To switch the default markup type,
|
|
121
|
+
pass `-m markdown` (or `-m rdoc`) to `yard doc`, or add it to your `.yardopts`
|
|
122
|
+
file.
|
|
123
|
+
|
|
124
|
+
For optional extra rendering features (e.g. GitHub-Flavoured Markdown fenced
|
|
125
|
+
code blocks, tables, or specific Markdown extensions), you can install an
|
|
126
|
+
additional provider gem such as `redcarpet`, `commonmarker`, or `kramdown` and
|
|
127
|
+
select it explicitly with `-M PROVIDER` (e.g. `yard doc -m markdown -M redcarpet`).
|
|
124
128
|
|
|
125
129
|
## Usage
|
|
126
130
|
|
|
127
131
|
There are a couple of ways to use YARD. The first is via command-line, and the
|
|
128
132
|
second is the Rake task.
|
|
129
133
|
|
|
130
|
-
|
|
134
|
+
### 1. yard Command-line Tool
|
|
131
135
|
|
|
132
136
|
YARD comes packaged with a executable named `yard` which can control the many
|
|
133
137
|
functions of YARD, including generating documentation, graphs running the YARD
|
|
@@ -140,7 +144,7 @@ $ yard --help
|
|
|
140
144
|
Plugins can also add commands to the `yard` executable to provide extra
|
|
141
145
|
functionality.
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
#### Generating Documentation
|
|
144
148
|
|
|
145
149
|
<span class="note">The `yardoc` executable is a shortcut for `yard doc`.</span>
|
|
146
150
|
|
|
@@ -185,9 +189,9 @@ Note that the README file can be specified with its own `--readme` switch.
|
|
|
185
189
|
You can also add a `.yardopts` file to your project directory which lists the
|
|
186
190
|
switches separated by whitespace (newlines or space) to pass to yardoc whenever
|
|
187
191
|
it is run. A full overview of the `.yardopts` file can be found in
|
|
188
|
-
|
|
192
|
+
[YARD::CLI::Yardoc](https://rubydoc.info/gems/yard/YARD/CLI/Yardoc#label-Options+File+-28.yardopts-29).
|
|
189
193
|
|
|
190
|
-
|
|
194
|
+
#### Queries
|
|
191
195
|
|
|
192
196
|
The `yardoc` tool also supports a `--query` argument to only include objects
|
|
193
197
|
that match a certain data or meta-data query. The query syntax is Ruby, though a
|
|
@@ -214,7 +218,7 @@ following two lines both check for the existence of a return and param tag:
|
|
|
214
218
|
|
|
215
219
|
For more information about the query syntax, see the {YARD::Verifier} class.
|
|
216
220
|
|
|
217
|
-
|
|
221
|
+
### 2. Rake Task
|
|
218
222
|
|
|
219
223
|
The second most obvious is to generate docs via a Rake task. You can do this by
|
|
220
224
|
adding the following to your `Rakefile`:
|
|
@@ -240,7 +244,7 @@ environment variable:
|
|
|
240
244
|
$ rake yard OPTS='--any --extra --opts'
|
|
241
245
|
```
|
|
242
246
|
|
|
243
|
-
|
|
247
|
+
### 3. `yri` RI Implementation
|
|
244
248
|
|
|
245
249
|
The yri binary will use the cached .yardoc database to give you quick ri-style
|
|
246
250
|
access to your documentation. It's way faster than ri but currently does not
|
|
@@ -264,7 +268,7 @@ $ yard gems
|
|
|
264
268
|
If you don't have sudo access, it will write these files to your `~/.yard`
|
|
265
269
|
directory. `yri` will also cache lookups there.
|
|
266
270
|
|
|
267
|
-
|
|
271
|
+
### 4. `yard server` Documentation Server
|
|
268
272
|
|
|
269
273
|
The `yard server` command serves documentation for a local project or all
|
|
270
274
|
installed RubyGems. To serve documentation for a project you are working on,
|
|
@@ -278,14 +282,14 @@ And the project inside the current directory will be parsed (if the source has
|
|
|
278
282
|
not yet been scanned by YARD) and served at
|
|
279
283
|
[http://localhost:8808](http://localhost:8808).
|
|
280
284
|
|
|
281
|
-
|
|
285
|
+
#### Live Reloading
|
|
282
286
|
|
|
283
287
|
If you want to serve documentation on a project while you document it so that
|
|
284
288
|
you can preview the results, simply pass `--reload` (`-r`) to the above command
|
|
285
289
|
and YARD will reload any changed files on each request. This will allow you to
|
|
286
290
|
change any documentation in the source and refresh to see the new contents.
|
|
287
291
|
|
|
288
|
-
|
|
292
|
+
#### Serving Gems
|
|
289
293
|
|
|
290
294
|
To serve documentation for all installed gems, call:
|
|
291
295
|
|
|
@@ -297,10 +301,10 @@ This will also automatically build documentation for any gems that have not been
|
|
|
297
301
|
previously scanned. Note that in this case there will be a slight delay between
|
|
298
302
|
the first request of a newly parsed gem.
|
|
299
303
|
|
|
300
|
-
|
|
304
|
+
### 5. `yard graph` Graphviz Generator
|
|
301
305
|
|
|
302
306
|
You can use `yard graph` to generate dot graphs of your code. This, of course,
|
|
303
|
-
requires [Graphviz](
|
|
307
|
+
requires [Graphviz](https://www.graphviz.org) and the `dot` binary. By default
|
|
304
308
|
this will generate a graph of the classes and modules in the best UML2 notation
|
|
305
309
|
that Graphviz can support, but without any methods listed. With the `--full`
|
|
306
310
|
option, methods and attributes will be listed. There is also a `--dependencies`
|
data/docs/GettingStarted.md
CHANGED
|
@@ -61,15 +61,41 @@ Using tags we can add semantic metadata to our code without worrying about
|
|
|
61
61
|
presentation. YARD will handle presentation for us when we decide to generate
|
|
62
62
|
documentation later.
|
|
63
63
|
|
|
64
|
+
### Disconnecting Comment Blocks
|
|
65
|
+
|
|
66
|
+
YARD attaches a comment block to the next relevant object by default. That is
|
|
67
|
+
usually what you want, but file headers are a common exception. If you keep a
|
|
68
|
+
copyright notice, license note or general file-level description at the top of
|
|
69
|
+
the file, it can accidentally become the docstring for the first class or
|
|
70
|
+
module unless you explicitly break the block.
|
|
71
|
+
|
|
72
|
+
To disconnect the block, end the header with an attached `#-` line:
|
|
73
|
+
|
|
74
|
+
# Copyright (c) Example Corp
|
|
75
|
+
# Shared support code for the client layer.
|
|
76
|
+
#-
|
|
77
|
+
|
|
78
|
+
class Client
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
In this example, the header comment is not attached to `Client`.
|
|
82
|
+
|
|
83
|
+
This only works with `#-`. If you write `# -` with a space before the hyphen,
|
|
84
|
+
YARD treats it as a normal comment line and it remains part of the docstring.
|
|
85
|
+
|
|
64
86
|
## Which Markup Format?
|
|
65
87
|
|
|
66
|
-
YARD does not impose a specific markup.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
YARD does not impose a specific markup format. YARD ships with a builtin
|
|
89
|
+
renderer that supports both RDoc and Markdown out of the box—no external gem
|
|
90
|
+
required. You can use either format (or switch between them) without installing
|
|
91
|
+
anything extra. YARD also supports textile, asciidoc, and other formats via
|
|
92
|
+
optional gems.
|
|
93
|
+
|
|
94
|
+
To select a markup format, use the command-line switch `-m FORMAT` or add
|
|
95
|
+
`--markup FORMAT` to your `.yardopts` file. This guide is written in Markdown.
|
|
96
|
+
YARD adds a few important syntaxes that are processed regardless of which
|
|
97
|
+
markup format you choose, such as tag support and inter-document linking.
|
|
98
|
+
These syntaxes are discussed below.
|
|
73
99
|
|
|
74
100
|
## Adding Tags to Documentation
|
|
75
101
|
|
|
@@ -182,7 +208,7 @@ Symbols:
|
|
|
182
208
|
We mentioned that these type fields are "mostly" free-form. In truth, they
|
|
183
209
|
are defined "by convention". To view samples of common type specifications
|
|
184
210
|
and recommended conventions for writing type specifications, see
|
|
185
|
-
[
|
|
211
|
+
[https://yardoc.org/types.html](https://yardoc.org/types.html). Note that these
|
|
186
212
|
conventions may change every now and then, although we are working on a more
|
|
187
213
|
"formal" type specification proposal.
|
|
188
214
|
|
|
@@ -200,7 +226,7 @@ YARD will automatically wire up the correct method types and information
|
|
|
200
226
|
by simply defining documentation in the `@return` tag. For example,
|
|
201
227
|
the following declaration will show the correct information for the
|
|
202
228
|
`waveform` attribute, both for the getter's return type and the
|
|
203
|
-
setter's value parameter type:
|
|
229
|
+
setter's value parameter type:
|
|
204
230
|
|
|
205
231
|
# @return [Numeric] the amplitude of the waveform
|
|
206
232
|
attr_accessor :amplitude
|
|
@@ -248,7 +274,7 @@ The most common is the `attr_accessor` method, which of course has built-in
|
|
|
248
274
|
support in YARD. However, frameworks and libraries often expose custom
|
|
249
275
|
methods that perform similar metaprogramming tasks, and it is often useful
|
|
250
276
|
to document their functionality in your application. Consider the `property`
|
|
251
|
-
method in a project like [DataMapper](
|
|
277
|
+
method in a project like [DataMapper](https://datamapper.org), which creates
|
|
252
278
|
a typed attribute for a database model. The code might look like:
|
|
253
279
|
|
|
254
280
|
class Post
|
|
@@ -386,11 +412,11 @@ If you want to use a Hash, prefix the first { with "!":
|
|
|
386
412
|
|
|
387
413
|
# !{ :some_key => 'value' }
|
|
388
414
|
|
|
389
|
-
### Linking URLs `{
|
|
415
|
+
### Linking URLs `{https://...}`
|
|
390
416
|
|
|
391
417
|
URLs are also linked using this `{...}` syntax:
|
|
392
418
|
|
|
393
|
-
{
|
|
419
|
+
{https://example.com Optional Title}
|
|
394
420
|
{mailto:email@example.com}
|
|
395
421
|
|
|
396
422
|
### Linking Files `{file:...}`
|
|
@@ -672,8 +698,8 @@ not exist, so you may need to create it.
|
|
|
672
698
|
You may find some useful YARD plugins on [RubyGems][RubyGemsQuery] or with
|
|
673
699
|
a [Google advanced query][GoogleAdvancedQuery].
|
|
674
700
|
|
|
675
|
-
[graphviz]:
|
|
676
|
-
[yard-rspec]:
|
|
677
|
-
[rspec]:
|
|
701
|
+
[graphviz]:https://www.graphviz.org
|
|
702
|
+
[yard-rspec]:https://github.com/lsegal/yard-spec-plugin
|
|
703
|
+
[rspec]:https://rspec.info
|
|
678
704
|
[GoogleAdvancedQuery]:https://www.google.com/search?q=site%3Arubygems.org+intitle%3A%22yard-%22+OR+intitle%3A%22yard_%22
|
|
679
705
|
[RubyGemsQuery]:https://rubygems.org/search?utf8=%E2%9C%93&query=name%3A+yard
|
data/docs/Parser.md
CHANGED
|
@@ -55,49 +55,10 @@ You can also provide the parser type explicitly as the second argument:
|
|
|
55
55
|
Note that these two methods are aliased as {YARD.parse} and {YARD.parse_string} for
|
|
56
56
|
convenience.
|
|
57
57
|
|
|
58
|
-
##
|
|
59
|
-
|
|
60
|
-
To implement a custom parser, subclass {YARD::Parser::Base}. Documentation on which
|
|
61
|
-
abstract methods should be implemented are documented in that class. After the class
|
|
62
|
-
is implemented, it is registered with the {YARD::Parser::SourceParser} factory class
|
|
63
|
-
to be called when a file of the right extension needs to be parsed, or when a user
|
|
64
|
-
selects that parser type explicitly. To register your new parser class, call the
|
|
65
|
-
method {YARD::Parser::SourceParser.register_parser_type}:
|
|
66
|
-
|
|
67
|
-
SourceParser.register_parser_type(:my_parser, MyParser, 'my_parser_ext')
|
|
68
|
-
|
|
69
|
-
The last argument can be a single extension, a list of extensions (Array), a single Regexp, or a
|
|
70
|
-
list of Regexps. Do not include the '.' in the extension.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## The Two Ruby Parser Types
|
|
74
|
-
|
|
75
|
-
When parsing Ruby, the SourceParser can either instantiate the new {YARD::Parser::Ruby::RubyParser}
|
|
76
|
-
class or the {YARD::Parser::Ruby::Legacy::StatementList} class. The first of the
|
|
77
|
-
two, although faster, more robust and more efficient, is only available for
|
|
78
|
-
Ruby 1.9. The legacy parser parser is available in both 1.8.x and 1.9, if
|
|
79
|
-
compatibility is required. The choice of parser will affect which handlers
|
|
80
|
-
ultimately get used, since new handlers can only use the new parser and the
|
|
81
|
-
same requirement applies to the legacy parser & handlers.
|
|
82
|
-
|
|
83
|
-
## Switching to Legacy Parser
|
|
84
|
-
|
|
85
|
-
By default, running YARD under Ruby 1.9 will automatically select the new parser
|
|
86
|
-
and new handlers by extension. Although YARD supports both handler styles, plugins
|
|
87
|
-
may choose to only implement one of the two (though this is not recommended). If
|
|
88
|
-
only the legacy handlers are implemented, the `SourceParser` class should force
|
|
89
|
-
the use of the legacy parser by setting the `parser_type` attribute as such:
|
|
58
|
+
## RubyParser
|
|
90
59
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
The default value is `:ruby`. Note that this cannot be forced the other way around,
|
|
94
|
-
a parser type of `:ruby` cannot be set under Ruby 1.8.x as the new parser is not
|
|
95
|
-
supported under 1.8.
|
|
96
|
-
|
|
97
|
-
## RubyParser (the New Parser)
|
|
98
|
-
|
|
99
|
-
The new Ruby parser uses the Ripper library that is packaged as part of stdlib
|
|
100
|
-
in Ruby 1.9. Because of this, it can generate an AST from a string of Ruby input
|
|
60
|
+
The Ruby parser uses the Ripper library that is packaged as part of stdlib.
|
|
61
|
+
Because of this, it can generate an AST from a string of Ruby input
|
|
101
62
|
that is similar to the style of other sexp libraries (such as ParseTree). Each
|
|
102
63
|
node generated in the tree is of the base type {YARD::Parser::Ruby::AstNode},
|
|
103
64
|
which has some subclasses for common node types.
|
|
@@ -163,6 +124,20 @@ to quickly get at a node of a specific type in such a situation:
|
|
|
163
124
|
Multiple types can be searched for at once. If none are found, the original root
|
|
164
125
|
node is returned so that it may be chained.
|
|
165
126
|
|
|
127
|
+
## Implementing and Registering a Custom Parser
|
|
128
|
+
|
|
129
|
+
To implement a custom parser, subclass {YARD::Parser::Base}. Documentation on which
|
|
130
|
+
abstract methods should be implemented are documented in that class. After the class
|
|
131
|
+
is implemented, it is registered with the {YARD::Parser::SourceParser} factory class
|
|
132
|
+
to be called when a file of the right extension needs to be parsed, or when a user
|
|
133
|
+
selects that parser type explicitly. To register your new parser class, call the
|
|
134
|
+
method {YARD::Parser::SourceParser.register_parser_type}:
|
|
135
|
+
|
|
136
|
+
SourceParser.register_parser_type(:my_parser, MyParser, 'my_parser_ext')
|
|
137
|
+
|
|
138
|
+
The last argument can be a single extension, a list of extensions (Array), a single Regexp, or a
|
|
139
|
+
list of Regexps. Do not include the '.' in the extension.
|
|
140
|
+
|
|
166
141
|
## The Legacy Parser
|
|
167
142
|
|
|
168
143
|
The goal of the legacy parser is much the same as the new parser, but it is far
|
data/docs/Tags.md
CHANGED
|
@@ -141,7 +141,7 @@ a set of conventions for how to list types is described below.
|
|
|
141
141
|
|
|
142
142
|
<p class="note">
|
|
143
143
|
A list of examples of common type listings and what they translate into is
|
|
144
|
-
available at <a href="
|
|
144
|
+
available at <a href="https://yardoc.org/types">https://yardoc.org/types</a>.
|
|
145
145
|
</p>
|
|
146
146
|
|
|
147
147
|
Typically, a type list contains a list of classes or modules that are associated
|
|
@@ -206,16 +206,17 @@ also be a list of types separated by commas.
|
|
|
206
206
|
An order dependent list is a set of types surrounded by "()" and separated by
|
|
207
207
|
commas. This list must contain exactly those types in exactly the order specified.
|
|
208
208
|
For instance, an Array containing a String, Fixnum and Hash in that order (and
|
|
209
|
-
having exactly those 3 elements) would be listed as: `Array
|
|
209
|
+
having exactly those 3 elements) would be listed as: `Array(String, Fixnum, Hash)`.
|
|
210
210
|
|
|
211
211
|
#### Literals
|
|
212
212
|
|
|
213
213
|
Some literals are accepted by virtue of being Ruby literals, but also by YARD
|
|
214
214
|
conventions. Here is a non-exhaustive list of certain accepted literal values:
|
|
215
215
|
|
|
216
|
-
* `true`, `false`, `nil` — used when a method returns
|
|
217
|
-
values. Note that if your method returns both
|
|
218
|
-
the `Boolean` conventional type
|
|
216
|
+
* `true`, `false`, `nil`, `:foo` — used when a method returns
|
|
217
|
+
these explicit literal values. Note that if your method returns both
|
|
218
|
+
`true` or `false`, you should use the `Boolean` conventional type
|
|
219
|
+
instead.
|
|
219
220
|
* `self` — has the same meaning as Ruby's "self" keyword in the context of
|
|
220
221
|
parameters or return types. Recommended mostly for {tag:return} tags that are
|
|
221
222
|
chainable.
|
|
@@ -280,4 +281,3 @@ Note that you might not need a tag title if you are hiding it. The title
|
|
|
280
281
|
part can be omitted.
|
|
281
282
|
|
|
282
283
|
{yard:include_tags}
|
|
283
|
-
|
data/docs/Templates.md
CHANGED
|
@@ -280,10 +280,11 @@ seen above by creating such a path in our '/path/to/mytemplates' custom template
|
|
|
280
280
|
path:
|
|
281
281
|
|
|
282
282
|
/path/to/mytemplates/:
|
|
283
|
-
|--
|
|
284
|
-
| |--
|
|
285
|
-
| | |--
|
|
286
|
-
| |--
|
|
283
|
+
|--default
|
|
284
|
+
| |-- class
|
|
285
|
+
| | |-- html
|
|
286
|
+
| | | |-- customsection.erb
|
|
287
|
+
| | |-- setup.rb
|
|
287
288
|
|
|
288
289
|
The `setup.rb` file would look like:
|
|
289
290
|
|