-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfixmanual
executable file
·48 lines (46 loc) · 937 Bytes
/
fixmanual
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
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env perl
use warnings;
$caption=0;
$head=1;
while(<STDIN>)
{
if($head && /^ / && !/\*\*\*/)
{
s:(\S+):<a href="#$1">$1</a>:g;
}
if(!/^~/)
{
print "$_";
next;
}
if(/^~\*end\*/)
{
print "</tt></pre>";
if($ARGV[0])
{
my $mtime = (stat($ARGV[0]))[9];
# GMT is unfriendly, but we don't know the timezone of last change
# vs the timezone of build machine.
print "Last modified: ".gmtime($mtime)." GMT" if $mtime;
}
print "</body></html>\n";
exit;
}
if(/^~~~/)
{
print "<hr>\n";
$head=$caption=0;
next;
}
if(/^~~H (.*)/)
{
print "<a name=\"$1\"></a><h5>$1</h5>\n";
$caption=1;
next;
}
if(/^~([^~].*)/)
{
print "<a name=\"$1\"></a>";
print "<h5>#$1</h5>" unless $caption;
}
}