-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allfuncs: generate the list from source
1. makes it up-to-date automatically 2. include the short description 3. make it a table to look a little easier on the eye 4. no more "deprecated" section in the bottom
- Loading branch information
Showing
3 changed files
with
72 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/perl | ||
|
||
my $docsdir = $ARGV[0]; | ||
|
||
opendir(my $dh, $docsdir) || die "Can't opendir $some_dir: $!"; | ||
my @manp = grep { /^curl_.*\.md/ } readdir($dh); | ||
closedir $dh; | ||
|
||
my %func; | ||
my %file; | ||
|
||
sub htmlver { | ||
my ($f)=@_; | ||
$f =~ s/\.md/.html/; | ||
$f =~ s/^.*\///; | ||
return $f; | ||
} | ||
|
||
sub manpage { | ||
my ($file)=@_; | ||
open(P, "<$file"); | ||
my $name = 0; | ||
my @f; | ||
while(<P>) { | ||
my $l = $_; | ||
chomp $l; | ||
if(/^# NAME/) { | ||
$name = 1; | ||
} | ||
elsif(/^#/ && $name) { | ||
last; | ||
} | ||
elsif($name) { | ||
my $desc; | ||
if($l =~ /(.*) - (.*)/) { | ||
$desc = $2; | ||
$l = $1; | ||
} | ||
for(split(/, */, $l)) { | ||
push @f, $_; | ||
} | ||
if($desc) { | ||
for(@f) { | ||
$func{$_} = $desc; | ||
$file{$_} = htmlver($file); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
for my $d (@manp) { | ||
manpage("$docsdir/$d"); | ||
} | ||
|
||
print "<table>\n"; | ||
my $even = 0; | ||
for my $f (sort keys %func) { | ||
printf "<tr class=\"%s\"><td><a href=\"%s\">%s</a></td><td>%s</td></tr>\n", | ||
$even ? "even" : "odd", | ||
$file{$f}, $f, $func{$f}; | ||
$even ^= 1; | ||
} | ||
print "</table>\n"; |