The script should not generate cross-references inside literal blocks.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -382,8 +382,27 @@ sub output_rest { · 381 unmodified lines | ||
| 382 | 382 | # Enrich text by creating cross-references |
| 383 | 383 | |
| 384 | 384 | my $new_desc = ""; |
| 385 | + my $init_indent = -1; | |
| 386 | + my $literal_indent = -1; | |
| 387 | + | |
| 385 | 388 | open(my $fh, "+<", \$desc); |
| 386 | 389 | 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 | + | |
| 387 | 406 | $d =~ s,Documentation/(?!devicetree)(\S+)\.rst,:doc:`/$1`,g; |
| 388 | 407 | |
| 389 | 408 | my @matches = $d =~ m,Documentation/ABI/([\w\/\-]+),g; |