aboutsummaryrefslogtreecommitdiff
path: root/mdwn2man
blob: 13b1b84a8131b0e80eaf323d315534a3c627555d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl
# Warning: hack

print ".TH ikiwiki 1\n";

while (<>) {
	s/^#\s/.SH /;
	s/^\s+//;
	s/^Warning:.*//g;
	s/^$/.PP\n/;
	s/\[\[//g;
	s/\]\]//g;
	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 $_;
}