2006-03-15 05:40:32 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
# Warning: hack
|
|
|
|
|
2006-05-05 22:48:20 +02:00
|
|
|
my $prog=shift;
|
|
|
|
my $section=shift;
|
|
|
|
|
|
|
|
print ".TH $prog $section\n";
|
2006-03-15 05:40:32 +01:00
|
|
|
|
|
|
|
while (<>) {
|
2007-03-31 08:56:52 +02:00
|
|
|
s{(\\?)\[\[([^\s\|\]]+)(\|[^\s\]]+)?\]\]}{$1 ? "[[$2]]" : $2}eg;
|
2008-05-30 23:50:59 +02:00
|
|
|
s/\`//g;
|
|
|
|
s/^\./\\./g;
|
2006-08-13 04:03:43 +02:00
|
|
|
if (/^#\s/) {
|
|
|
|
s/^#\s/.SH /;
|
|
|
|
<>; # blank;
|
|
|
|
}
|
2006-03-15 05:40:32 +01:00
|
|
|
s/^\s+//;
|
2006-08-13 04:03:43 +02:00
|
|
|
s/-/\\-/g;
|
2006-03-15 05:40:32 +01:00
|
|
|
s/^Warning:.*//g;
|
|
|
|
s/^$/.PP\n/;
|
|
|
|
s/^\*\s+(.*)/.IP "$1"/;
|
|
|
|
next if $_ eq ".PP\n" && $skippara;
|
|
|
|
if (/^.IP /) {
|
|
|
|
$inlist=1;
|
|
|
|
$spippara=0;
|
|
|
|
}
|
|
|
|
elsif (/.SH/) {
|
|
|
|
$skippara=0;
|
|
|
|
$inlist=0;
|
|
|
|
}
|
|
|
|
elsif (/^\./) {
|
|
|
|
$skippara=1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$skippara=0;
|
|
|
|
}
|
|
|
|
if ($inlist && $_ eq ".PP\n") {
|
|
|
|
$_=".IP\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
print $_;
|
|
|
|
}
|