From: Daniel Stenberg Date: Fri, 14 Oct 2022 06:55:37 +0000 (+0200) Subject: markdown-uppercase: ignore quoted sections X-Git-Tag: curl-7_86_0~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=05f477ad4b53b998e16e0f7cd6d4f614bb0d404d;p=thirdparty%2Fcurl.git markdown-uppercase: ignore quoted sections Sections within the markdown ~~~ or ``` are now ignored. Closes #9733 --- diff --git a/tests/markdown-uppercase.pl b/tests/markdown-uppercase.pl index 3aa8ac07bc..fe298d4730 100644 --- a/tests/markdown-uppercase.pl +++ b/tests/markdown-uppercase.pl @@ -41,37 +41,46 @@ sub checkfile { open(F, "<$f"); my $l = 1; my $prevl; + my $ignore = 0; while() { my $line = $_; chomp $line; - if(($prevl =~ /\.\z/) && ($line =~ /^( *)([a-z]+)/)) { - my ($prefix, $word) = ($1, $2); - if(!$accepted{$word}) { - my $c = length($prefix); - print STDERR "$f:$l:$c:error: lowercase $word after period\n"; - print STDERR "$line\n"; - print STDERR ' ' x $c; - print STDERR "^\n"; - $errors++; - } + if($line =~ /^(\`\`\`|\~\~\~)/) { + # start or stop ignore-mode + $ignore ^= 1; } - if($line =~ /^(.*)\. +([a-z]+)/) { - my ($prefix, $word) = ($1, $2); - - if(($prefix =~ /\.\.\z/) || - ($prefix =~ /[0-9]\z/) || - ($prefix =~ /e.g\z/) || - ($prefix =~ /i.e\z/) || - ($prefix =~ /etc\z/) || - $accepted{$word}) { + if(!$ignore) { + if(($prevl =~ /\.\z/) && ($line =~ /^( *)([a-z]+)/)) { + my ($prefix, $word) = ($1, $2); + if(!$accepted{$word}) { + my $c = length($prefix); + print STDERR + "$f:$l:$c:error: lowercase $word after period\n"; + print STDERR "$line\n"; + print STDERR ' ' x $c; + print STDERR "^\n"; + $errors++; + } } - else { - my $c = length($prefix) + 2; - print STDERR "$f:$l:$c:error: lowercase $word after period\n"; - print STDERR "$line\n"; - print STDERR ' ' x $c; - print STDERR "^\n"; - $errors++; + elsif($line =~ /^(.*)\. +([a-z]+)/) { + my ($prefix, $word) = ($1, $2); + + if(($prefix =~ /\.\.\z/) || + ($prefix =~ /[0-9]\z/) || + ($prefix =~ /e.g\z/) || + ($prefix =~ /i.e\z/) || + ($prefix =~ /etc\z/) || + $accepted{$word}) { + } + else { + my $c = length($prefix) + 2; + print STDERR + "$f:$l:$c:error: lowercase $word after period\n"; + print STDERR "$line\n"; + print STDERR ' ' x $c; + print STDERR "^\n"; + $errors++; + } } } $prevl = $line;