3 # postconf2html - add HTML paragraphs
7 # - Process input as text blocks separated by one or more empty
8 # (or all whitespace) lines.
10 # - Skip text between <!-- and -->; each must be on a different line.
12 # - Don't touch blocks that start with `<' in column zero.
14 # The only changes made are:
16 # - Emit "<DT><a name="parametername">parametername</a>...</DT><DD>" at
17 # the top of each parameter description.
19 # All other non-comment input is flagged as an error.
27 #die "Usage: $0 [-hv]\n" if ($opt_h);
29 #push @ARGV, "/dev/null"; # XXX
36 # Skip blank lines before text block.
39 # Gobble up the next text block.
47 if ($comment && $_ =~ /-->/)
48 { $comment = 0; $block =~ s/<!--.*-->//sg; }
49 } while((($_ = <>) && /\S/) || $comment);
51 # Skip blanks after comment elimination.
52 if ($block =~ /^\s/) {
54 next if ($block eq "");
57 # Don't touch a text block starting with < in column zero.
62 # Meta block. Emit upper case tags for html2man.
63 elsif ($block =~ /^%PARAM/) {
64 print "\n</DD>\n\n" if ($param);
65 print "\n<DL>\n\n" if ($need_dl);
67 ($junk, $param, $defval) = split(/\s+/, $block, 3);
69 $defval = "empty" if ($defval eq "");
70 $defval = "default: $defval" unless ($defval eq "read-only");
71 print "<DT><b><a name=\"$param\">$param</a>\n($defval)</b></DT><DD>\n\n";
74 # Meta block. Emit upper case tags for html2man.
75 elsif ($block =~ /^%CLASS/) {
76 print "\n</DD>\n\n" if ($param);
77 print "\n</DL>\n\n" if ($class);
79 ($junk, $class, $text) = split(/\s+/, $block, 3);
81 print "<H2><a name=\"$class\">$text</a></H2>\n\n";
87 die "Unrecognized text block:\n$block";
91 print "\n</DD>\n\n" if ($param);
92 print "\n</DL>\n\n" if ($class);