1 #!/usr/bin/perl
2 undef $/; #slurp alll
3 $_ = <>;
4 while (s/<page[\s\n\r]+(\S+)\s*=\s*(?:"([^"]+)"|([^"\s>]+))/<page/si){
5 chomp($VAL{uc($1)}= $2 ? $2: $3);
6 }
8 if ($VAL{TYPE} eq 'lone') {
9 $sub="_$VAL{TYPE}";
10 }
12 s|<page[\s\n\r]*/?>|#include <inc/template${sub}.inc> PAGE="$VAL{PAGE}" AUTHOR="$VAL{AUTHOR}" TYPE="$VAL{TYPE}"\n|si;
14 print;