pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/templates genreadme: Improve generated HTML markup



details:   https://anonhg.NetBSD.org/pkgsrc/rev/173d18e41b7a
branches:  trunk
changeset: 447576:173d18e41b7a
user:      nia <nia%pkgsrc.org@localhost>
date:      Mon Feb 22 09:32:55 2021 +0000

description:
genreadme: Improve generated HTML markup

Don't use tables for everything, it's not 1999 any more.

Remove another hack for Solaris 9.

diffstat:

 mk/scripts/genreadme.awk  |  58 +++++++++++++---------------------------------
 templates/README.category |  17 ++++++-------
 templates/README.top      |   6 ++--
 3 files changed, 28 insertions(+), 53 deletions(-)

diffs (203 lines):

diff -r 2f81b42e9300 -r 173d18e41b7a mk/scripts/genreadme.awk
--- a/mk/scripts/genreadme.awk  Mon Feb 22 09:24:58 2021 +0000
+++ b/mk/scripts/genreadme.awk  Mon Feb 22 09:32:55 2021 +0000
@@ -1,5 +1,5 @@
 #!/usr/bin/awk -f
-# $NetBSD: genreadme.awk,v 1.45 2021/02/22 05:32:02 nia Exp $
+# $NetBSD: genreadme.awk,v 1.46 2021/02/22 09:32:55 nia Exp $
 #
 # Copyright (c) 2002-2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -201,10 +201,6 @@
        wildcard[$2] = $3;
 }
 
-#
-# Now recurse the tree to give a flattened depends list for each pkg
-#
-
 END {
        readme = TMPDIR "/" readme_name;
 
@@ -242,9 +238,9 @@
 
 # extract date for vulnerabilities file
        if (SCAN_VULNERABILITIES == 0)
-               vuldate="<TR><TD><I>(no vulnerabilities list, update pkg_install)</I>";
+               vuldate="<li><em>(no vulnerabilities list, update pkg_install)</em></li>";
        else if (SCAN_VULNERABILITIES == 1)
-               vuldate="<TR><TD><I>(no vulnerabilities list available)</I>";
+               vuldate="<li><em>(no vulnerabilities list available)</em></li>";
 
        if (SINGLEPKG != "" ) {
                printf("Only creating README for %s\n",SINGLEPKG);
@@ -292,13 +288,13 @@
                                        if (status == "fixed")
                                                continue
                                        status = "a " status;
-                                       vul =  sprintf("%s<LI>%s <a href=\"%s\">%s</a> vulnerability</LI>\n",
+                                       vul =  sprintf("%s<li>%s <a href=\"%s\">%s</a> vulnerability</li>\n",
                                          vul, status, entry[3], entry[2]);
                                }
                                close(cmd);
 
                                if ( vul == "" ) {
-                                       vul="<I>(no vulnerabilities known)</I>";
+                                       vul="<em>(no vulnerabilities known)</em>";
                                }
                        }
 
@@ -400,8 +396,6 @@
                        }
                        cat_make = catdir"/Makefile";
                        pkgs = "";
-                       pkgs_file = TMPDIR "/pkgs_file";
-                       printf("") > pkgs_file;
                        numpkg = 0;
                        print "" > readme;
                        while((getline < cat_make) > 0){
@@ -418,20 +412,12 @@
                                                 pkgdir2name[dir],
                                                 comment[dir]);
                                        }
-#                                      pkgs =  sprintf("%s<TR><TD VALIGN=TOP><a href=\"%s/%s\">%s</a>: %s<TD>\n",
-#                                                      pkgs, pkg, readme_name,
-#                                                      pkgdir2name[dir],
-#                                                      comment[dir]);
-# We use a temp file to hold the list of all packages because
-# this list can get very very large and
-# become larger than what some awk implementations can deal
-# with.  The nawk shipped with solaris 9 is an example of
-# such a limited awk.
-                                       printf("<TR><TD VALIGN=TOP><a href=\"%s/%s\">%s</a>: %s<TD>\n",
-                                                       pkg, readme_name,
-                                                       pkgdir2name[dir],
-                                                       comment[dir]) >> pkgs_file;
-                                       allpkg[tot_numpkg] =  sprintf("<!-- %s (for sorting) --><TR VALIGN=TOP><TD><a href=\"%s/%s/%s\">%s</a>: <TD>(<a href=\"%s/%s\">%s</a>) <td>%s\n",
+                                       pkgs = sprintf("%s<dt><a href=\"%s/%s\">%s</a></dt><dd>%s</dd>\n",
+                                           pkgs,
+                                           pkg, readme_name,
+                                           pkgdir2name[dir],
+                                           comment[dir]);
+                                       allpkg[tot_numpkg] = sprintf("<!-- %s (for sorting) --><tr><td><a href=\"%s/%s/%s\">%s</a></td><td><a href=\"%s/%s\">%s</a></td><td>%s</td>\n",
                                                                      pkgdir2name[dir],
                                                                      category, pkg,
                                                                      readme_name,
@@ -453,26 +439,16 @@
                                gsub(/%%CATEGORY%%/, category);
                                gsub(/%%NUMITEMS%%/, numpkg);
                                gsub(/%%DESCR%%/, descr);
-
-                               line = $0
+                               gsub(/%%SUBDIR%%/, ""pkgs"");
 
-                               if( $0 ~/%%SUBDIR%%/ ) {
-                                   gsub(/%%SUBDIR%%/, "", line);
-                                   while((getline < pkgs_file) > 0) {
-                                     gsub(/README.html/, readme_name);
-                                     print >> readme;
-                                   }
-                                   close( pkgs_file );
-                               }
-
-                               print line >> readme;
+                               print $0 >> readme;
                        }
                        close(readme);
                        close(templatefile);
                        copy_readme(readmenew, readme);
 
                        gsub(/href=\"/, "href=\""category"/", pkgs);
-                       allcat = sprintf("%s<TR><TD VALIGN=TOP><a href=\"%s/%s\">%s</a>: %s<TD>\n",
+                       allcat = sprintf("%s<dt><a href=\"%s/%s\">%s</a></dt><dd>%s</dd>\n",
                                         allcat, category, readme_name,
                                         category, descr);
                        close(cat_make);
@@ -556,7 +532,7 @@
                i = i + 1;
        }
        if ( i == 1 ) {
-         htmldeps = "<EM>none</EM>";
+         htmldeps = "<em>(none)</em>";
        }
        return htmldeps;
 }
@@ -750,12 +726,12 @@
   binpkgs_file = TMPDIR "/binpkgs";
   spipe = SORT " > " binpkgs_file;
   for(i=1 ; i<=pkg_count[d]; i=i+1) {
-    printf("<TR><TD>%s:<TD><a href=\"%s/%s\">%s</a><TD>(%s %s)\n",
+    printf("<tr><td>%s:<td><a href=\"%s/%s\">%s</a><td>(%s %s)\n",
       march_list[d, i], PKG_URL, pkgfile_list[d, i], pkgnm_list[d, i],
       opsys_list[d, i], osver_list[d, i]) | spipe;
   }
   if( pkg_count[d] == 0 ) {
-       printf("<TR><TD><EM>none</EM></TD></TR>\n") | spipe;
+       printf("<tr><td><em>(none)</em></td></tr>\n") | spipe;
   }
 
   close( spipe );
diff -r 2f81b42e9300 -r 173d18e41b7a templates/README.category
--- a/templates/README.category Mon Feb 22 09:24:58 2021 +0000
+++ b/templates/README.category Mon Feb 22 09:32:55 2021 +0000
@@ -1,31 +1,30 @@
-<!-- $NetBSD: README.category,v 1.12 2021/02/22 05:10:18 nia Exp $ -->
+<!-- $NetBSD: README.category,v 1.13 2021/02/22 09:32:55 nia Exp $ -->
 <!doctype html>
 <html lang="en">
 <head>
 <meta charset="utf-8">
 <link href="../templates/main.css" rel="stylesheet">
-<title>The NetBSD Packages Collection: %%CATEGORY%%</title>
+<title>%%CATEGORY%% - The NetBSD Packages Collection</title>
 </head>
 <body>
 
 <a href="http://www.mckusick.com/beastie/mainpage/copyright.html";>
 <img src="../templates/pkg-daemon.gif" alt="Daemon Power" id="logo">
 </a>
-<h1>The NetBSD Packages Collection: <i>%%CATEGORY%%</i></h1>
-
-<p>You are now in the directory "%%CATEGORY%%".
+<h1><em>%%CATEGORY%%</em> - The NetBSD Packages Collection</h1>
 
 <p>
 %%DESCR%%
+</p>
 
 <p>Here are the one-line descriptions for each of the
 %%NUMITEMS%%
-items in this directory:
+items in this directory:</p>
 
-<p><hr noshade>
-<p><table>
+<hr noshade>
+<dl>
 %%SUBDIR%%
-</table>
+</dl>
 
 <hr noshade>
 [
diff -r 2f81b42e9300 -r 173d18e41b7a templates/README.top
--- a/templates/README.top      Mon Feb 22 09:24:58 2021 +0000
+++ b/templates/README.top      Mon Feb 22 09:32:55 2021 +0000
@@ -1,4 +1,4 @@
-<!-- $NetBSD: README.top,v 1.20 2021/02/21 10:19:53 nia Exp $ -->
+<!-- $NetBSD: README.top,v 1.21 2021/02/22 09:32:55 nia Exp $ -->
 <!doctype html>
 <html lang="en">
 <head>
@@ -24,9 +24,9 @@
 </p>
 
 <hr noshade>
-<table>
+<dl>
 %%SUBDIR%%
-</table>
+</dl>
 <hr noshade>
 
 Prebuilt binary packages can be installed using



Home | Main Index | Thread Index | Old Index