diff options
Diffstat (limited to 'Documentation/lint-gitlink.perl')
| -rwxr-xr-x | Documentation/lint-gitlink.perl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Documentation/lint-gitlink.perl b/Documentation/lint-gitlink.perl index 1c61dd9512..f183a18df2 100755 --- a/Documentation/lint-gitlink.perl +++ b/Documentation/lint-gitlink.perl @@ -5,7 +5,7 @@ use warnings; # Parse arguments, a simple state machine for input like: # -# <file-to-check.txt> <valid-files-to-link-to> --section=1 git.txt git-add.txt [...] --to-lint git-add.txt a-file.txt [...] +# <file-to-check.adoc> <valid-files-to-link-to> --section=1 git.adoc git-add.adoc [...] --to-lint git-add.adoc a-file.adoc [...] my %TXT; my %SECTION; my $section; @@ -17,7 +17,7 @@ for my $arg (@ARGV) { next; } - my ($name) = $arg =~ /^(.*?)\.txt$/s; + my ($name) = $arg =~ /^(.*?)\.adoc$/s; unless (defined $section) { $TXT{$name} = $arg; next; @@ -41,6 +41,13 @@ die "BUG: No list of valid linkgit:* files given" unless @ARGV; @ARGV = $to_check; while (<>) { my $line = $_; + while ($line =~ m/(.{,8})((git[-a-z]+|scalar)\[(\d)*\])/g) { + my $pos = pos $line; + my ($macro, $target, $page, $section) = ($1, $2, $3, $4); + if ( $macro ne "linkgit:" && $macro !~ "ifn?def::" && $macro ne "endif::" ) { + report($pos, $line, $target, "linkgit: macro expected"); + } + } while ($line =~ m/linkgit:((.*?)\[(\d)\])/g) { my $pos = pos $line; my ($target, $page, $section) = ($1, $2, $3); |
