#!/usr/bin/perl -w # --edit the above to point at your Perl installation # --*BSD users may want to change the above to !/usr/pkg/bin/perl -w # generates a Flavorplex-style hints page from a "raw" # text file. Lines in the input file begin with one of: # .t : The title of the hints page (name of game, etc. Only 1 of these) # .s : Section heading # .q : Question # .a : Answer # --save a little bit of typing. MAIN: { # start html document: print < Flavorplex Game Hints
EOS # translate raw to html: while (<>) { chomp; if (/^\./) { $t = $_; $t =~ s/^\.//; $t =~ s/ .*$//; s/\.. //; # .t := title (should come before all others): if ($t eq "t") { print "

$_

\n\n"; } # .s := section: elsif ($t eq "s") { print "

$_

\n\n"; } # .q := question: elsif ($t eq "q") { $hintno = 1; print "

$_

\n"; } # .a := answer: elsif ($t eq "a") { $hint = $_ ; &addHint($hintno, $hint); ++$hintno; } } } # end the html doc: print < EOF } sub addHint { # error message, and force retry: print <
Hint $hintno:

$hint

EOH return; }