Fix ref links in main page #285
Merged
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.
The main page reuses an already-processed file. All of the ref links in that file will be rendered relative to its path rather than relative to the root. For example, ref links in
railties/RDOC_MAIN.md
will be relative tofiles/railties/
, so a link toActiveRecord::Base
would use../../ActiveRecord/Base.html
instead ofActiveRecord/Base.html
.This commit changes
RDoc::Generator::SDoc#index
to dup the processed file and override itspath
value such that links on the main page use the root-relative path (but links on the file's page will still use thefiles/
-relative path).This change also makes it unnecessary to escape occurrences of "Rails" in the main page because, with the correct
href
, the postprocessor will now recognize them as unintentional ref links.