History

scripts: get_abi: ignore code blocks for cross-references

The script should not generate cross-references inside literal blocks.

Mauro Carvalho Chehab committed 5 years ago

Commit 2ae7bb51 parent c27c2e31 file · +19 −0Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/get_abi.pl+19−0
@@ -382,8 +382,27 @@ sub output_rest { · 381 unmodified lines
382382 # Enrich text by creating cross-references
383383
384384 my $new_desc = "";
385+ my $init_indent = -1;
386+ my $literal_indent = -1;
387+
385388 open(my $fh, "+<", \$desc);
386389 while (my $d = <$fh>) {
390+ my $indent = $d =~ m/^(\s+)/;
391+ my $spaces = length($indent);
392+ $init_indent = $indent if ($init_indent < 0);
393+ if ($literal_indent >= 0) {
394+ if ($spaces > $literal_indent) {
395+ $new_desc .= $d;
396+ next;
397+ } else {
398+ $literal_indent = -1;
399+ }
400+ } else {
401+ if ($d =~ /()::$/ && !($d =~ /^\s*\.\./)) {
402+ $literal_indent = $spaces;
403+ }
404+ }
405+
387406 $d =~ s,Documentation/(?!devicetree)(\S+)\.rst,:doc:`/$1`,g;
388407
389408 my @matches = $d =~ m,Documentation/ABI/([\w\/\-]+),g;