ikiwiki/mdwn2man

35 lines
474 B
Plaintext
Raw Normal View History

2006-03-15 05:40:32 +01:00
#!/usr/bin/perl
# Warning: hack
print ".TH ikiwiki 1\n";
while (<>) {
s{(\\?)\[\[([^\s\]]+)\]\]}{$1 ? "[[$2]]" : $2}eg;
2006-03-15 05:40:32 +01:00
s/^#\s/.SH /;
s/^\s+//;
s/^Warning:.*//g;
s/^$/.PP\n/;
s/\`//g;
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 $_;
}