4 my ($faq,$var,$env,$q,$a,$c,$s,$t,$n);
6 my @sections = qw'Meta User Admin Misc';
8 @faq = ($faq) = $ENV{PATH_INFO} =~ /(\w+).html/;
9 @faq = map {lc} @sections if $faq eq 'all';
11 print "<style type=text/css><!-- h2,h3 {font-weight:normal} --></style>\n";
13 print '<h1><a name="top" href="/index.html">F*EX</a> ';
14 printf "Frequently Asked Questions: %s</h1>\n",ucfirst($faq);
16 if ($faq ne 'local') {
17 print "<h3>Sections: ";
18 foreach $s (@sections,'All') {
22 printf "[<a href=\"%s.html\">%s</a>]\n",lc($s),$s;
31 foreach my $faq (@faq) {
32 open $faq,"$faq.faq" or next;
37 while (/\$([\w_]+)\$/) {
39 $env = $ENV{$var} || '';
40 # s/\$$var\$/<code>$env<\/code>/g;
43 ($q,$a) = split /A:\s*/;
46 $q =~ s! (/\w[\S]+/[\S]+)! <code>$1</code>!g;
49 while ($a =~ s/^(\s*)\*/$1<ul>\n$1<li>/m) {
50 while ($a =~ s/(<li>.*\n\s*)\*/$1<li>/g) {}
51 $a =~ s:(.*\n)(\s*)(<li>[^\n]+\n):$1$2$3$2</ul>\n:s
53 $a =~ s/\n\n/\n<p>\n/g;
54 $a =~ s/([^>\n\\])\n/$1<br>\n/g;
55 $a =~ s/<pre>(.+?)<\/pre>/pre($1)/ges;
57 # $a =~ s/^\s*<br>\s*//mg;
58 $a =~ s/<([^\s<>\@]+\@[\w.-]+)>/<a href="mailto:$1"><$1><\/a>/g;
59 $a =~ s! (/\w[\S]+/[\S]+)! <code>$1</code>!g;
60 $a =~ s!(https?://[\w-]+\.[^\s<>()]+)!<a href="$1">[$1]</a>!g or
61 $a =~ s!(https?://[^\s<>()]+)!<code>$1</code></a>!g;
70 foreach $s (sections($faq)) {
73 $s = '' if $s eq 'Local';
75 $t = $s if $faq eq 'all';
77 for ($n = 0; $n < scalar(@{$Q{$c}}); $n++) {
80 printf '<tr valign=top><th align=left>'.
81 '<a href="#%s%d" style="text-decoration: none">'.
82 '<font color="black">%s Q%d</a>:'.
83 '<td><a href="#%s">%s</a></tr>'."\n",
84 $t,$n+1,$s,$n+1,$qa,$q;
91 foreach $s (sections($faq)) {
94 $s = '' if $s eq 'Local';
96 $t = $s if $faq eq 'all';
98 for ($n = 0; $n < scalar(@{$Q{$c}}); $n++) {
103 printf "<tr valign=top><th>".
104 "<a name=\"%s%d\">%s Q%d:</a>".
105 "<a name=\"%s\"></a>".
106 "<td><b>%s</b></tr>\n",
107 $t,$n+1,$s,$n+1,$qa,$q;
108 printf "<tr valign=top><th>%s A%d:<td>\n%s</tr>\n",
109 $s,$n+1,${A{$c}[$n]};
111 print "[<a href=\"#top\">↑ Questions</a>]\n";
125 return ucfirst($faq);
133 return "<pre>$_</pre>\n";