[pull] master from ruby:master#209
Merged
Merged
Conversation
## Problem RDoc already supports parser classes that register handled file names through [`parse_files_matching`](https://ruby.github.io/rdoc/RDoc/Parser.html#method-c-parse_files_matching), but `.rbs` documentation parsing currently comes from the `rbs` gem's `rdoc/discover` hook, which defines `RDoc::Parser::RBS` and delegates to `RBS::RDocPlugin::Parser` at runtime ([discovery hook](https://github.com/ruby/rbs/blob/master/lib/rdoc/discover.rb), [plugin parser](https://github.com/ruby/rbs/blob/master/lib/rdoc_plugin/parser.rb)). That leaves RBS documentation generation coupled to a separately released plugin even though RDoc already uses RBS for type-signature display ([#1665](#1665)), and internal RDoc API changes can break the plugin independently of RDoc releases ([#1711](#1711)). ## Solution - Add `RDoc::Parser::RBS` inside RDoc, adapted from the existing RBS plugin parser, so `.rbs` files are registered as RDoc input and common RBS declarations/members become RDoc code objects ([RBS plugin parser](https://github.com/ruby/rbs/blob/master/lib/rdoc_plugin/parser.rb), [PR diff](https://github.com/ruby/rdoc/pull/1728/files)). - Extend existing Ruby-source documentation when matching RBS declarations are parsed, while still generating documentation for classes, modules, methods, attributes, and constants that only appear in RBS ([PR diff](https://github.com/ruby/rdoc/pull/1728/files)). - Keep RDoc's existing `sig/**/*.rbs` type-signature loading path and skip the released `rbs` discovery hook when RDoc's parser is available, so RubyGems discovery does not replace the in-tree parser ([#1665](#1665), [discovery hook](https://github.com/ruby/rbs/blob/master/lib/rdoc/discover.rb), [PR diff](https://github.com/ruby/rdoc/pull/1728/files)).
## Problem While reviewing #1571, I noticed a small follow-up refactoring opportunity in the superclass-method notice rendered by the HTML templates. Both Aliki and Darkfish were reaching through `method.formatter` directly to build the superclass method link. That leaves template code responsible for formatter details and makes the escaping boundary less explicit. ## Solution - Add `RDoc::AnyMethod#superclass_method_link` as the generator-facing helper for rendering the superclass method link. - Escape the visible link text inside that helper while preserving the raw method name for cross-reference lookup. - Update the Aliki and Darkfish templates to call the new helper instead of constructing formatter links directly. - Cover the helper behavior with a generator markup unit test, including operator method names such as `<<`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )