Print a short description for every category in

- the index.sgml file
	- and at the begin of all <category>.sgml files.
This commit is contained in:
Wolfram Schneider 1998-11-10 19:16:03 +00:00
parent 5e6e5b6d9a
commit 20102dac8e
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=3774

View file

@ -41,6 +41,7 @@ if ($urlcgi) {
$today = &getdate;
&packages_exist('packages.exists', *packages);
&category_description('categories', *category_description);
&main;
sub getdate {
@ -89,6 +90,27 @@ sub packages_exist {
return 0;
}
sub category_description {
local($file, *p) = @_;
open(P, $file) || do {
warn "open $file: $!\n";
warn "Cannot find category description\n";
return 1;
};
local($category, $description);
while(<P>) {
# ignore comments
next if /^\s*#/;
($category, $description) = /^\s*"([^"]+)",\s*"([^"]+)/;
$p{$category} = $description;
}
close P;
return 0;
}
sub main {
$sep = "<B>:</B>";
@ -197,11 +219,18 @@ browse the following categories:\n";
foreach $key (@foos) {
# For the master file...
print MOUTF
"<LI><A HREF=\"$key.html\">\u$key</A> <em>($stats{$key})</em></LI>";
"<LI><A HREF=\"$key.html\">\u$key</A> <em>($stats{$key})</em>";
if ($category_description{$key}) {
print MOUTF " -- " . $category_description{$key};
}
print MOUTF "</LI>\n";
# Create the category file
open(OUTF, ">$key.sgml");
&header(OUTF, "FreeBSD Ports: \u$key");
if ($category_description{$key}) {
print OUTF "<h3>", $category_description{$key}, "</h3>\n";
}
print OUTF "<DL>\n";
$d = join("\n", sort(split(/\n/, $data{$key})));
$d =~ s/##([^#]*)##/$catkey{$1}/g;