chiark
/
gitweb
/
~ianmdlvl
/
quacks.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
cut line
[quacks.git]
/
gen-index
1
#!/usr/bin/perl -w
2
use strict;
3
our $input = shift @ARGV;
4
our @books = @ARGV;
5
@ARGV=($input);
6
7
while (<>) {
8
if (m{^\<\!-- book-\*\s} .. m{\s--\>\s*$}) {
9
if (m{\[delete\]}) {
10
next;
11
} elsif (m{BOOK}) {
12
my $orig = $_;
13
foreach my $book (@books) {
14
$_ = $orig;
15
s{\bBOOK\b}{$book}g;
16
print;
17
}
18
next;
19
}
20
}
21
print;
22
}