Deduplicate entries in reference index #2302
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.
When a single documentation entry (say, a function) contains multiple
@usage
entries with the same function name, this leads to duplicate entries in the ‘pkgdown’ reference entry.A concrete use-case can be found in the ‘box’ package:
Currently this is rendered as follows:
This PR removes redundant entries in the rendered reference index and adds a relevant test case. I have also added a test case for the similar case of an S3 method that is documented on the same page as its generic. This use-case is currently not affected by the duplicate-entry behaviour but I found it prudent to proactively add a regression test.
Admittedly this is an extreme niche case. However, there’s some precedent for this
\usage
usage in base R, notably in the documentation of the:
operator:… as well as the documentation of the
[
extract operator.