]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - mdwn2man
on second though, just remove done patches
[git.ikiwiki.info.git] / mdwn2man
1 #!/usr/bin/perl
2 # Warning: hack
4 my $prog=shift;
5 my $section=shift;
7 print ".TH $prog $section\n";
9 while (<>) {
10         s{(\\?)\[\[([^\s\]]+)\]\]}{$1 ? "[[$2]]" : $2}eg;
11         s/^#\s/.SH /;
12         s/^\s+//;
13         s/^Warning:.*//g;
14         s/^$/.PP\n/;
15         s/\`//g;
16         s/^\*\s+(.*)/.IP "$1"/;
17         next if $_ eq ".PP\n" && $skippara;
18         if (/^.IP /) {
19                 $inlist=1;
20                 $spippara=0;
21         }
22         elsif (/.SH/) {
23                 $skippara=0;
24                 $inlist=0;
25         }
26         elsif (/^\./) {
27                 $skippara=1;
28         }
29         else {
30                 $skippara=0;
31         }
32         if ($inlist && $_ eq ".PP\n") {
33                 $_=".IP\n";
34         }
36         print $_;
37 }