diff options
Diffstat (limited to 'scripts/documentation-file-ref-check')
-rwxr-xr-x | scripts/documentation-file-ref-check | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check index d132f756d31d..047f463cdf4b 100755 --- a/scripts/documentation-file-ref-check +++ b/scripts/documentation-file-ref-check | |||
@@ -38,16 +38,31 @@ while (<IN>) { | |||
38 | my $f = $1; | 38 | my $f = $1; |
39 | my $ln = $2; | 39 | my $ln = $2; |
40 | 40 | ||
41 | # Makefiles contain nasty expressions to parse docs | 41 | # Makefiles and scripts contain nasty expressions to parse docs |
42 | next if ($f =~ m/Makefile/); | 42 | next if ($f =~ m/Makefile/ || $f =~ m/\.sh$/); |
43 | |||
43 | # Skip this script | 44 | # Skip this script |
44 | next if ($f eq $scriptname); | 45 | next if ($f eq $scriptname); |
45 | 46 | ||
46 | if ($ln =~ m,\b(\S*)(Documentation/[A-Za-z0-9\_\.\,\~/\*\[\]\?+-]*),) { | 47 | if ($ln =~ m,\b(\S*)(Documentation/[A-Za-z0-9\_\.\,\~/\*\[\]\?+-]*)(.*),) { |
47 | my $prefix = $1; | 48 | my $prefix = $1; |
48 | my $ref = $2; | 49 | my $ref = $2; |
49 | my $base = $2; | 50 | my $base = $2; |
51 | my $extra = $3; | ||
52 | |||
53 | # some file references are like: | ||
54 | # /usr/src/linux/Documentation/DMA-{API,mapping}.txt | ||
55 | # For now, ignore them | ||
56 | next if ($extra =~ m/^{/); | ||
57 | |||
58 | # Remove footnotes at the end like: | ||
59 | # Documentation/devicetree/dt-object-internal.txt[1] | ||
60 | $ref =~ s/(txt|rst)\[\d+]$/$1/; | ||
61 | |||
62 | # Remove ending ']' without any '[' | ||
63 | $ref =~ s/\].*// if (!($ref =~ m/\[/)); | ||
50 | 64 | ||
65 | # Remove puntuation marks at the end | ||
51 | $ref =~ s/[\,\.]+$//; | 66 | $ref =~ s/[\,\.]+$//; |
52 | 67 | ||
53 | my $fulref = "$prefix$ref"; | 68 | my $fulref = "$prefix$ref"; |