mirror of
https://github.com/curl/curl.git
synced 2026-01-18 17:21:26 +01:00
mdlinkcheck: only look for markdown links in markdown files
It finds debug outputs in source code otherwise. Output the whitelist "warnings" to stderr to better allow us to count URLs with `./mdlinkcheck --dry-run | wc -l`. Closes #19938
This commit is contained in:
@@ -158,9 +158,12 @@ sub findlinks {
|
||||
open(F, "<:crlf", "$f") ||
|
||||
return;
|
||||
|
||||
# is it a markdown extension?
|
||||
my $md = ($f =~ /\.md$/i);
|
||||
|
||||
while(<F>) {
|
||||
chomp;
|
||||
if(/\]\(([^)]*)/) {
|
||||
if($md && /\]\(([^)]*)/) {
|
||||
my $link = $1;
|
||||
#print "$f:$line $link\n";
|
||||
storelink($f, $line, $link);
|
||||
@@ -209,7 +212,7 @@ for my $f (@files) {
|
||||
|
||||
for my $u (sort keys %whitelist) {
|
||||
if($whitelist{$u} == 1) {
|
||||
printf "warning: unused whitelist entry: '$u'\n";
|
||||
printf STDERR "warning: unused whitelist entry: '$u'\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user