11 chomp; # strip record separator
12 s/([^\\](\\\\)*)\\\".*/$1/g; # strip comments
18 while ($_ =~ /[A-Za-z0-9\-\.]+/g) {
24 print htmlify($_), "\n";
32 $a[3] = htmlify($a[3]);
33 print "<title>$a[2] : $a[3]</title><h1>$a[2] : $a[3]</h1>\n";
39 $a[2] = htmlify($a[2]);
40 print "<samp>[##:##] Command : </samp><KBD>$a[2]</KBD><p>\n";
45 my $str = htmlify(join(' ',@a[2..$#a]));
46 print "<br><samp>[##:##] Command : </samp><kbd>$str</kbd><p>\n";
52 print "<br>" . anchor("$`") . " $'\n";
56 if ($a[1] =~ "eo") { $esc = 0; next line; }
57 if ($a[1] =~ "ec") { $esc = $#a == 1 ? "\\" : $a[2]; next line; }
59 if (/^\.(NF|nf)/) { $dome = 1; printf (("<p><pre>\n")); next line; }
60 if (/^\.(FI|fi)/) { $dome = 0; printf (("</pre><p>\n")); next line; }
61 if (/^\.s3/) { printf (("<p>\n")); next line; }
62 if (/^\.s1/) { printf (("<hr> \n")); next line; }
63 if (/^\.br/) { printf "<br>\n"; next line; }
67 @a = split(/[\: \"\,\.]+/, $a[2]);
71 print "<p>See also : ", join("\n, ", @a), "\n";
74 # ignore unknown request
79 if (/^([\.\'])[ \t]*([^ ]+) *(.*)/) {
82 while (/(\"((\\.|[^\\\"])*)(\"|\Z))|(([^ ]|\\.)+) */g) {
92 warn "extra arguments for $a[1] ignored" if $#a > $n+1;
93 warn "missing arguments for $a[1] supplied" if $#a < $n+1;
102 # FIXME don't create dangling links here
103 return "<a href=\"$_.html\">$_</a>";
106 # Translate HTML special characters into escape sequences
109 die "funny escape character `$esc' not supported"
110 if $esc && $esc ne "\\";
111 # translate some troff escapes
112 s/\\&//g if $esc; # zero width space character
113 # escape HTML special characters
117 return $_ unless $esc;
118 # translate more troff escapes
119 s/\\e/&\#92;/g; # escape character
120 # turn quoted strings that look like info names into links
122 while (/(\\\*Q)([A-Za-z0-9\-\.]+)(\\\*U)/) {
123 $_ = $` . anchor($2) . "$'";
125 while (/(\"info )([A-Za-z0-9\-\.]+)/) {
126 $_ = "$`\"info " . anchor($2) . "$'";
128 # tranlate more troff escapes and strings
132 s/\\fR/<\/em><\/em>/g;
134 s/\\fP/<\/strong><\/em>/g;
135 s/\\\*\(bF/<strong>/g; # bold font
136 s/\\\*\(pF/<\/strong><\/em>/g; # pica font
137 s/\\\*\(nF/<\/strong><\/em>/g; # normal font
138 s/\\\*\(iF/<em>/g; # italic font
139 s/\\\(mu/x/g; # multiply symbol
140 s/\\ / /g; # non breaking space