5 $filename =~ /^(.*)\.([^.]*)$/;
9 print "Processing $filename...\n";
13 open(fi, "<$filename");
16 last if(/snip:chapter/);
24 /!!!"(.*)"!!!/;$name = $1;
29 if(/snip:\/chapter/) {
39 $chapters[$nr++] = $chapter;
41 /!!!"(.*)"!!!/;$name = $1;
56 for($nr=1;$nr<$num;$nr++) {
59 my $filename = "$basename.$nr.$extension";
60 print "Creating $filename...\n";
61 for($n=1;$n<$num;$n++) {
63 $h2 =~ s/chapterlink$n/<a href="$basename.$n.$extension">>$names[$n]<<\/a>/;
65 $h2 =~ s/chapterlink$n/<a href="$basename.$n.$extension">$names[$n]<\/a>/;
70 $prev = $names[$nr-1];
71 $aprev = $basename.".".($nr-1).".".$extension;
72 $t2 =~ s/__prevlink__/<a href="$aprev">Previous: $prev<\/a>/;
74 $t2 =~ s/__prevlink__/ /;
78 $anext = $basename.".".($nr+1).".".$extension;
80 $t2 =~ s/__nextlink__/<a href="$anext">Next: $next<\/a>/;
82 $t2 =~ s/__nextlink__/ /;
84 $t2 =~ s/__currentchapter__/$names[$nr]/;
86 open(fi, ">$filename");
87 print fi "$h2\n$chapters[$nr]\n$t2";