3 my ($faq,$var,$env,$q,$a,$c,$s,$t,$n);
5 my @sections = qw'Meta User Admin Misc';
7 @faq = ($faq) = $ENV{PATH_INFO} =~ /(\w+).html/;
8 @faq = map {lc} @sections if $faq eq 'all';
10 print "<style type=text/css><!-- h2,h3 {font-weight:normal} --></style>\n";
12 print '<h1><a name="top" href="/index.html">F*EX</a> ',
13 " Frequently Asked Questions</h1>\n";
15 if ($faq ne 'local') {
17 foreach $s (@sections,'All') {
21 printf "[<a href=\"%s.html\">%s</a>]\n",lc($s),$s;
29 foreach my $faq (@faq) {
30 open $faq,"$faq.faq" or next;
35 while (/\$([\w_]+)\$/) {
37 $env = $ENV{$var} || '';
38 # s/\$$var\$/<code>$env<\/code>/g;
41 ($q,$a) = split /A:\s*/;
43 $q =~ s! (/\w[\S]+/[\S]+)! <code>$1</code>!g;
45 while ($a =~ s/^(\s*)\*/$1<ul>\n$1<li>/m) {
46 while ($a =~ s/(<li>.*\n\s*)\*/$1<li>/g) {}
47 $a =~ s:(.*\n)(\s*)(<li>[^\n]+\n):$1$2$3$2</ul>\n:s
49 $a =~ s/\n\n/\n<p>\n/g;
50 $a =~ s/([^>\n\\])\n/$1<br>\n/g;
51 $a =~ s/<pre>(.+?)<\/pre>/pre($1)/ges;
53 # $a =~ s/^\s*<br>\s*//mg;
54 $a =~ s/<([^\s<>\@]+\@[\w.-]+)>/<a href="mailto:$1"><$1><\/a>/g;
55 $a =~ s! (/\w[\S]+/[\S]+)! <code>$1</code>!g;
56 $a =~ s!(https?://[\w-]+\.[^\s<>]+)!<a href="$1">[$1]</a>!g or
57 $a =~ s!(https?://[^\s<>]+)!<code>$1</code></a>!g;
66 foreach $s (sections($faq)) {
69 $s = '' if $s eq 'Local';
71 $t = $s if $faq eq 'all';
73 for ($n = 0; $n < scalar(@{$Q{$c}}); $n++) {
74 printf "<tr><th align=left>%s Q%d:<td> <a href=\"#%s%d\">%s</tr>\n",
75 $s,$n+1,$t,$n+1,${Q{$c}[$n]};
81 foreach $s (sections($faq)) {
84 $s = '' if $s eq 'Local';
86 $t = $s if $faq eq 'all';
88 for ($n = 0; $n < scalar(@{$Q{$c}}); $n++) {
91 printf "<tr><th><a name=\"%s%d\">%s Q%d:</a><td>%s</tr>\n",
92 $t,$n+1,$s,$n+1,${Q{$c}[$n]};
93 printf "<tr valign=top><th>%s A%d:<td>\n%s</tr>\n",
95 print "<tr><th>[<a href=\"#top\">Top</a>]<td></tr>\n";
110 return ucfirst($faq);
118 return "<pre>$_</pre>\n";