blob: 172bd9c3c3076185ddd98b262504b90483fd68bc (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#! /usr/bin/perl
#
# docs/reference/beautify_docs.pl. Generated from beautify_docs.pl.in by configure.
#
#sub main()
{
my $directory = ".";
$directory = $ARGV[0] unless scalar(@ARGV) == 0;
print "processing directory $directory...\n" unless $directory =~ /^\.?$/;
foreach(`find "$directory" -type f -name '*.html'`)
{
chomp;
/([^\/]+)$/;
print "processing $1...\n";
&process($_);
}
exit 0;
}
sub process($)
{
my ($file) = @_;
my @outbuf;
open(FILE, '<', $file);
while(<FILE>)
{
if(/<a class="el"/)
{
# return value
s/ & /& /;
s/ \* /* /;
# arg list
s/ &/&/g;
s/&\b/& /g;
s/ \*/*/g;
s/\*\b/* /g;
# templates
s/\btemplate<\b/template </;
while(s/(.*<) +(.+) +(>.*)/$1$2$3/) {}
}
elsif(/<td class="md(|name)"/)
{
# left parenthesis
s/\( /(/;
# return value
s/ & /& /g;
s/ \* /* /g;
# arg list
s/ & /& /g;
s/ \* /* /g;
# templates
s/\btemplate<\b/template </;
while(s/(.*<) +(.+) +(>.*)/$1$2$3/) {}
}
else
{
# template decls
s/^(|<h\d>)template<\b/$1template </;
}
push(@outbuf, $_);
}
open(FILE, '>', $file);
# write the whole buffer back
print FILE "$_" foreach(@outbuf);
close(FILE);
}
|