* Fix issue with unicode filenames and updating the hyper estradier search
[ikiwiki] / mdwn2man
1 #!/usr/bin/perl
2 # Warning: hack
3
4 my $prog=shift;
5 my $section=shift;
6
7 print ".TH $prog $section\n";
8
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         }
35
36         print $_;
37 }