From 20102dac8e8d7552880ec8387d114f3eb0484760 Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Tue, 10 Nov 1998 19:16:03 +0000 Subject: [PATCH] Print a short description for every category in - the index.sgml file - and at the begin of all .sgml files. --- en/ports/portindex | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/en/ports/portindex b/en/ports/portindex index 6cea58103e..4572a31f8a 100755 --- a/en/ports/portindex +++ b/en/ports/portindex @@ -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(

) { + # ignore comments + next if /^\s*#/; + + ($category, $description) = /^\s*"([^"]+)",\s*"([^"]+)/; + $p{$category} = $description; + } + close P; + return 0; +} + sub main { $sep = ":"; @@ -197,11 +219,18 @@ browse the following categories:\n"; foreach $key (@foos) { # For the master file... print MOUTF - "

  • \u$key ($stats{$key})
  • "; + "
  • \u$key ($stats{$key})"; + if ($category_description{$key}) { + print MOUTF " -- " . $category_description{$key}; + } + print MOUTF "
  • \n"; # Create the category file open(OUTF, ">$key.sgml"); &header(OUTF, "FreeBSD Ports: \u$key"); + if ($category_description{$key}) { + print OUTF "

    ", $category_description{$key}, "

    \n"; + } print OUTF "
    \n"; $d = join("\n", sort(split(/\n/, $data{$key}))); $d =~ s/##([^#]*)##/$catkey{$1}/g;