diff options
author | Richard Levitte <levitte@openssl.org> | 2019-11-23 21:41:35 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-11-27 16:18:28 +0100 |
commit | 76fde1db3c2c2159aaf56fb8995368c25f88f9a4 (patch) | |
tree | 790dd8ed399435c40ca4040b9764470f7d59334b /util | |
parent | 2a03823606b2d7e73e5dc890c3202e186511151f (diff) |
util/find-doc-nits: Better parsing of links
When checking links, we need to peal away stuff that aren't part of
the link proper first. That makes it easier to check the link
itself.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10507)
Diffstat (limited to 'util')
-rwxr-xr-x | util/find-doc-nits | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/util/find-doc-nits b/util/find-doc-nits index 687657bf9d..da6e49f781 100755 --- a/util/find-doc-nits +++ b/util/find-doc-nits @@ -450,12 +450,14 @@ sub check { # Make sure every link has a section. while ( $contents =~ /$markup_re/msg ) { my $target = $1; - next unless $target =~ /^L</; # Skip if not L<...>, or + next unless $target =~ /^L<(.*)>$/; # Skip if not L<...> + $target = $1; # Peal away L< and > + $target =~ s/\/[^\/]*$//; # Peal away possible anchor + $target =~ s/.*\|//g; # Peal away possible link text + next if $target eq ''; # Skip if links within page, or next if $target =~ /::/; # links to a Perl module, or - next if $target =~ m@L</@; # links within the page, or - next if $target =~ /^L<https?:/; # is a URL link, or - next if $target =~ m@\([1357]\)>$@; # it has a section, or - next if $target =~ m@\([1357]\)/.*>$@; # it has a section/anchor + next if $target =~ /^https?:/; # is a URL link, or + next if $target =~ /\([1357]\)$/; # it has a section err($id, "Section missing in $target") } # Check for proper links to commands. |