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 printf "Frequently Asked Questions: %s</h1>\n",ucfirst($faq);
15 if ($faq ne 'local') {
16 print "<h3>Sections: ";
17 foreach $s (@sections,'All') {
21 printf "[<a href=\"%s.html\">%s</a>]\n",lc($s),$s;
30 foreach my $faq (@faq) {
31 open $faq,"$faq.faq" or next;
36 while (/\$([\w_]+)\$/) {
38 $env = $ENV{$var} || '';
39 # s/\$$var\$/<code>$env<\/code>/g;
42 ($q,$a) = split /A:\s*/;
45 $q =~ s! (/\w[\S]+/[\S]+)! <code>$1</code>!g;
48 while ($a =~ s/^(\s*)\*/$1<ul>\n$1<li>/m) {
49 while ($a =~ s/(<li>.*\n\s*)\*/$1<li>/g) {}
50 $a =~ s:(.*\n)(\s*)(<li>[^\n]+\n):$1$2$3$2</ul>\n:s
52 $a =~ s/\n\n/\n<p>\n/g;
53 $a =~ s/([^>\n\\])\n/$1<br>\n/g;
54 $a =~ s/<pre>(.+?)<\/pre>/pre($1)/ges;
56 # $a =~ s/^\s*<br>\s*//mg;
57 $a =~ s/<([^\s<>\@]+\@[\w.-]+)>/<a href="mailto:$1"><$1><\/a>/g;
58 $a =~ s! (/\w[\S]+/[\S]+)! <code>$1</code>!g;
59 $a =~ s!(https?://[\w-]+\.[^\s<>()]+)!<a href="$1">[$1]</a>!g or
60 $a =~ s!(https?://[^\s<>()]+)!<code>$1</code></a>!g;
69 foreach $s (sections($faq)) {
72 $s = '' if $s eq 'Local';
74 $t = $s if $faq eq 'all';
76 for ($n = 0; $n < scalar(@{$Q{$c}}); $n++) {
79 printf '<tr valign=top><th align=left>'.
80 '<a href="#%s%d" style="text-decoration: none">'.
81 '<font color="black">%s Q%d</a>:'.
82 '<td><a href="#%s">%s</a></tr>'."\n",
83 $t,$n+1,$s,$n+1,$qa,$q;
90 foreach $s (sections($faq)) {
93 $s = '' if $s eq 'Local';
95 $t = $s if $faq eq 'all';
97 for ($n = 0; $n < scalar(@{$Q{$c}}); $n++) {
102 printf "<tr valign=top><th>".
103 "<a name=\"%s%d\">%s Q%d:</a>".
104 "<a name=\"%s\"></a>".
105 "<td><b>%s</b></tr>\n",
106 $t,$n+1,$s,$n+1,$qa,$q;
107 printf "<tr valign=top><th>%s A%d:<td>\n%s</tr>\n",
108 $s,$n+1,${A{$c}[$n]};
110 print "[<a href=\"#top\">↑ Questions</a>]\n";
124 return ucfirst($faq);
132 return "<pre>$_</pre>\n";