2013-02-28 11:20:14 +00:00
|
|
|
#!/usr/bin/env perl
|
2010-10-19 19:17:26 +00:00
|
|
|
# Warning: hack
|
|
|
|
|
|
|
|
my $prog=shift;
|
|
|
|
my $section=shift;
|
|
|
|
|
|
|
|
print ".TH $prog $section\n";
|
|
|
|
|
|
|
|
while (<>) {
|
2023-05-15 20:00:30 +00:00
|
|
|
s{(\\?)\[\[([^:\s\|\]]+)(\|[^\s\]]+)?\]\]}{$1 ? "[[$2]]" : $2}eg;
|
2013-09-12 16:59:53 +00:00
|
|
|
s/\`([^\`]*)\`/\\fB$1\\fP/g;
|
2010-10-19 19:17:26 +00:00
|
|
|
s/\`//g;
|
2016-08-16 15:51:16 +00:00
|
|
|
s/^ *\./\\&./g;
|
2010-10-19 19:17:26 +00:00
|
|
|
if (/^#\s/) {
|
|
|
|
s/^#\s/.SH /;
|
|
|
|
<>; # blank;
|
|
|
|
}
|
2010-12-10 21:27:02 +00:00
|
|
|
s/^[ \n]+//;
|
2010-10-19 19:17:26 +00:00
|
|
|
s/^\t/ /;
|
|
|
|
s/-/\\-/g;
|
2015-04-20 20:04:09 +00:00
|
|
|
s/git\\-annex/git-annex/g;
|
2016-04-20 18:29:54 +00:00
|
|
|
s/^Warning:.*mdwn2man.*//g;
|
2010-10-19 19:17:26 +00:00
|
|
|
s/^$/.PP\n/;
|
|
|
|
s/^\*\s+(.*)/.IP "$1"/;
|
2023-07-13 23:55:38 +00:00
|
|
|
s/\\$/\\\\/;
|
2010-10-19 19:17:26 +00:00
|
|
|
next if $_ eq ".PP\n" && $skippara;
|
|
|
|
if (/^.IP /) {
|
|
|
|
$inlist=1;
|
|
|
|
$spippara=0;
|
|
|
|
}
|
2013-09-12 17:17:25 +00:00
|
|
|
elsif (/^.SH/) {
|
2010-10-19 19:17:26 +00:00
|
|
|
$skippara=0;
|
|
|
|
$inlist=0;
|
|
|
|
}
|
|
|
|
elsif (/^\./) {
|
|
|
|
$skippara=1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$skippara=0;
|
|
|
|
}
|
|
|
|
if ($inlist && $_ eq ".PP\n") {
|
|
|
|
$_=".IP\n";
|
|
|
|
}
|
|
|
|
|
2015-05-22 20:06:21 +00:00
|
|
|
if ($inNAME) {
|
|
|
|
# make lexgrog happy
|
2015-07-09 15:22:37 +00:00
|
|
|
s/^git-annex (\w)/git-annex-$1/;
|
2015-05-22 20:06:21 +00:00
|
|
|
}
|
|
|
|
if ($_ eq ".SH NAME\n") {
|
|
|
|
$inNAME=1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$inNAME=0;
|
|
|
|
}
|
2016-04-04 21:11:35 +00:00
|
|
|
s/\\"/\\\\"/g; # hack for git-annex-shell's quotes around SSH_ORIGINAL_COMMAND
|
2015-05-22 20:06:21 +00:00
|
|
|
|
2010-10-19 19:17:26 +00:00
|
|
|
print $_;
|
|
|
|
}
|