podcheck.t: Fix multiple link targets bug #22771
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.
podcheck.t would wrongly warn about duplicate link targets. It is
ambiguous if you have, say
=head1 foo
...
=item foo
and then try to create a link to 'foo'. Which 'foo' should it go to?
So podcheck looks for such ambiguous links. However, it was incorrectly
warning on
=head1 foo
...
=item * foo
The latter is a bullet list, which is not an appropriate link target.
The logic was flawed in the node() method, when it encountered the
second foo, it didn't realize it was for a bullet list, and pushed it
onto a list which caused the count to be larger than 1, which caused it
later to think there were two link targets with the same name.
The solution here is to instead note that linkable targets are only in
=headN or definition lists. The acquisition of the names of them are
moved to the methods that get called upon the termination of each of
these by the parsing routines. The count is incremented at that point.
This means the node() method extension no longer does anything useful
and is removed; as well as an auxiliary field, linkable_item. We no
longer need to distinguish between =headN and =item.