my %backs;
for my $pth (keys %mtimes) {
my %found;
- open(my $fh, "<", $pth) or die "$!";
- while (<$fh>) {
- foreach my $w (split /\s+/) {
+ my sub procline;
+ sub procline {
+ if (/^include \[(.*)\]\r$/) {
+ open(my $fh, "<", $1) or die "$!";
+ while (<$fh>) { procline $_ }
+ close $fh;
+ return;
+ }
+ foreach my $w (split /\s+/, $_[0]) {
next unless $w =~ /\[([^]]+)\]/;
$w = $1;
if ($w =~ /\/$/) {
my $w = substr $w, 0, -1;
if (not exists $cats{$w}) {
print "missing $w\n" if exists $ENV{ZK_PRINT_MISSING};
- next;
+ return;
}
} else {
if (not exists $mtimes{$w}) {
print "missing $w\n" if exists $ENV{ZK_PRINT_MISSING};
- next;
+ return;
}
}
$found{$w} = 1;
}
}
+ open(my $fh, "<", $pth) or die "$!";
+ while (<$fh>) { procline $_ }
close $fh;
my @ws = sort keys %found;
next if $#ws == -1;
print $out "</head>\n<body>\n<pre>";
my $doLinksForced = 0;
my $doBacksForced = 0;
- open(my $fh, "<", $page) or die "$!";
- while (<$fh>) {
+ my sub procline;
+ sub procline {
+ $_ = $_[0];
chop;
if (/\r$/) {
chop;
}
} elsif ($cols[0] eq "do-links") {
$doLinksForced = 1;
- next;
+ return;
} elsif ($cols[0] eq "do-backs") {
$doBacksForced = 1;
- next;
+ return;
} elsif ($cols[0] eq "raw") {
$_ = join " ", @cols[1..$#cols];
} elsif ($cols[0] eq "#") {
- # this is commented string
- next;
+ return;
+ } elsif ($cols[0] eq "include") {
+ open(my $fh, "<", substr $cols[1], 1, -1) or die "$!";
+ while (<$fh>) { procline $_ }
+ close $fh;
+ return;
} else {
die "unknown $cols[0] command: $page\n";
}
}
print $out "$_\n";
}
+ open(my $fh, "<", $page) or die "$!";
+ while (<$fh>) { procline $_ }
close $fh;
print $out "</pre>\n";
if ($doLinksForced or ($doLinks and $#lnks != -1)) {