chiark / gitweb /
Pumpkin values in md file
[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 }