web commit by BrandenRobinson: Fix missing end brackets in wikilink.
[ikiwiki.git] / mdwn2man
1 #!/usr/bin/perl
2 # Warning: hack
3
4 print ".TH ikiwiki 1\n";
5
6 while (<>) {
7         s/^#\s/.SH /;
8         s/^\s+//;
9         s/^Warning:.*//g;
10         s/^$/.PP\n/;
11         s/\[\[//g;
12         s/\]\]//g;
13         s/\`//g;
14         s/^\*\s+(.*)/.IP "$1"/;
15         next if $_ eq ".PP\n" && $skippara;
16         if (/^.IP /) {
17                 $inlist=1;
18                 $spippara=0;
19         }
20         elsif (/.SH/) {
21                 $skippara=0;
22                 $inlist=0;
23         }
24         elsif (/^\./) {
25                 $skippara=1;
26         }
27         else {
28                 $skippara=0;
29         }
30         if ($inlist && $_ eq ".PP\n") {
31                 $_=".IP\n";
32         }
33
34         print $_;
35 }