repo.or.cz
/
ikiwiki.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
fix data:image handling
[ikiwiki.git]
/
mdwn2man
blob
e78a4d18cf6da8046e9a998d4d7ff738deae6037
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
if
(
/^#\s/
) {
12
s/^#\s/.SH /
;
13
<>;
# blank;
14
}
15
s/^\s+//
;
16
s/-/\\-/g
;
17
s/^Warning:.*//g
;
18
s/^$/.PP\n/
;
19
s/\`//g
;
20
s/^\*\s+(.*)/.IP "$1"/
;
21
next if
$_
eq
".PP
\n
"
&&
$skippara
;
22
if
(
/^.IP /
) {
23
$inlist
=
1
;
24
$spippara
=
0
;
25
}
26
elsif
(
/.SH/
) {
27
$skippara
=
0
;
28
$inlist
=
0
;
29
}
30
elsif
(
/^\./
) {
31
$skippara
=
1
;
32
}
33
else
{
34
$skippara
=
0
;
35
}
36
if
(
$inlist
&&
$_
eq
".PP
\n
"
) {
37
$_
=
".IP
\n
"
;
38
}
39
40
print
$_
;
41
}