linkcheck: add HyperlinkCollector.find_url()
#12213
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.
Feature or Bugfix
Purpose
The following tweaks the linkcheck builder's
HyperlinkCollector
transform to process links with anadd_uri
method on the transform (over an internal function inside the implementation). This can allow extensions to derive and register additional transforms usingHyperlinkCollector
to help inject hyperlinks intoCheckExternalLinksBuilder
for custom node types that may have a hyperlink value to check.Details
While extensions can already override
HyperlinkCollector
to inject custom links, it needs to replicate some of the logic used to add a href value as aHyperlink
into a builder. This causes some duplication with emitting an event, line number finding and duplicate link checking. If theadd_uri
is available on the transform, extensions only need to care about finding the application refnode and href value.Relates