|
4 | 4 | my %include = ();
|
5 | 5 | my %included = ();
|
6 | 6 |
|
7 |
| -for my $text (<*.txt>) { |
8 |
| - open I, '<', $text || die "cannot read: $text"; |
| 7 | +for my $adoc (<*.adoc>) { |
| 8 | + open I, '<', $adoc || die "cannot read: $adoc"; |
9 | 9 | while (<I>) {
|
10 | 10 | if (/^include::/) {
|
11 | 11 | chomp;
|
12 | 12 | s/^include::\s*//;
|
13 | 13 | s/\[\]//;
|
14 | 14 | s/{build_dir}/${build_dir}/;
|
15 |
| - $include{$text}{$_} = 1; |
| 15 | + $include{$adoc}{$_} = 1; |
16 | 16 | $included{$_} = 1;
|
17 | 17 | }
|
18 | 18 | }
|
|
23 | 23 | my $changed = 1;
|
24 | 24 | while ($changed) {
|
25 | 25 | $changed = 0;
|
26 |
| - while (my ($text, $included) = each %include) { |
| 26 | + while (my ($adoc, $included) = each %include) { |
27 | 27 | for my $i (keys %$included) {
|
28 |
| - # $text has include::$i; if $i includes $j |
29 |
| - # $text indirectly includes $j. |
| 28 | + # $adoc has include::$i; if $i includes $j |
| 29 | + # $adoc indirectly includes $j. |
30 | 30 | if (exists $include{$i}) {
|
31 | 31 | for my $j (keys %{$include{$i}}) {
|
32 |
| - if (!exists $include{$text}{$j}) { |
33 |
| - $include{$text}{$j} = 1; |
| 32 | + if (!exists $include{$adoc}{$j}) { |
| 33 | + $include{$adoc}{$j} = 1; |
34 | 34 | $included{$j} = 1;
|
35 | 35 | $changed = 1;
|
36 | 36 | }
|
|
40 | 40 | }
|
41 | 41 | }
|
42 | 42 |
|
43 |
| -foreach my $text (sort keys %include) { |
44 |
| - my $included = $include{$text}; |
45 |
| - if (! exists $included{$text} && |
46 |
| - (my $base = $text) =~ s/\.txt$//) { |
| 43 | +foreach my $adoc (sort keys %include) { |
| 44 | + my $included = $include{$adoc}; |
| 45 | + if (! exists $included{$adoc} && |
| 46 | + (my $base = $adoc) =~ s/\.adoc$//) { |
47 | 47 | print "$base.html $base.xml : ", join(" ", sort keys %$included), "\n";
|
48 | 48 | }
|
49 | 49 | }
|
0 commit comments