r326 - scripts/trunk

jhuntwork at linuxfromscratch.org jhuntwork at linuxfromscratch.org
Sat Jun 25 17:28:50 PDT 2005


Author: jhuntwork
Date: 2005-06-25 18:28:50 -0600 (Sat, 25 Jun 2005)
New Revision: 326

Modified:
   scripts/trunk/genlist.sh
   scripts/trunk/update-website.mk
Log:
Updates to genlist.sh for hints and uncommented use of it in update-website.mk

Modified: scripts/trunk/genlist.sh
===================================================================
--- scripts/trunk/genlist.sh	2005-06-23 13:10:54 UTC (rev 325)
+++ scripts/trunk/genlist.sh	2005-06-26 00:28:50 UTC (rev 326)
@@ -13,6 +13,12 @@
 #	- Assume .txt extension for hints, ignoring files like README and LICENSE
 #	- Skip hints not conforming to the default format
 
+# Changes by Jeremy Huntwork:
+#	[2005-06-25]
+#	- Changed the htmlclean function to use one-line perl script by Anderson
+#	- Removed header and footer output - will use SSI on new site
+#	- Changed format (html tags) of the output data
+
 # Usage: run in the hints/ subdirectory.
 
 #   Limitations
@@ -24,22 +30,20 @@
 
 # the file to which to write
 
-OUTPUTFILE="list.html"
+OUTPUTFILE="hintlist.html"
 
 function output
 {
     # echoes its argument to OUTPUTFILE
-
     echo $1 >> $OUTPUTFILE
 }
 
 
 function htmlclean
 {
-    # replaces '<' and '>' with the corresponding entities so that they
-    # can appear in documents (useful for the authors' email addresses).
-
-    echo `echo $1 | sed -e 's/>/\>/g' -e 's/</\</g'`
+    # Obscures author names and email addresses
+    var=`echo $1 | perl -pe 's/[^\n]/"\&#".ord($&)."\;"/ge'`
+    echo $var
 } 
 
 
@@ -49,35 +53,18 @@
 HINTS=`grep -H "DATE:" downloads/files/*.txt | sort -fbi -r -k3 -t: | cut -f1 -d:`
 
 # initialise output file
+>$OUTPUTFILE
 
-cat ../templates/hints/list-top.html > $OUTPUTFILE # The top of the list.
-
-# write hints
-
 for HINT in $HINTS
 do
     DATE=`echo \`grep -h "DATE:" $HINT | cut -f2 -d:\``
     SYNOPSIS=`echo \`grep -h "SYNOPSIS:" $HINT | cut -f2 -d:\``
-    AUTHORS=`echo \`grep -h "AUTHOR:" $HINT | \
-        cut -f2 -d: | sed 's/$/,/'\` | sed 's/,$//'`
-#    LICENSE=`echo \`grep -h "LICENSE:" $HINT | cut -f2 -d:\``
+    AUTHORS=`echo \`grep -h "AUTHOR:" $HINT | cut -f2 -d: | sed 's/$/,/'\` | sed 's/,$//'`
 
-	if [ -z "$DATE" -o -z "$SYNOPSIS" -o -z "$AUTHORS" ]; then continue; fi
+    if [ -z "$DATE" -o -z "$SYNOPSIS" -o -z "$AUTHORS" ]; then continue; fi
 
-    output "<li><h4><a href=\"$HINT\" title=\"$HINT\">$SYNOPSIS</a></h4>"
-    output "<dl>"
-    output "<dt>Author(s):</dt>"
-    output "<dd>`htmlclean "$AUTHORS"`</dd>"
-    output "<dt>Date Last Updated:</dt>"
-    output "<dd>$DATE</dd>"
-#    output "<dt>License:</dt>"
-#    output "<dd>$LICENSE</dd>"
-    output "</dl>"
-    output "</li>"
+    output "<p><a href=\"$HINT\" title=\"$HINT\">$SYNOPSIS</a><br />"
+    output "Author(s): `htmlclean "$AUTHORS"`<br />"
+    output "Date Last Updated: $DATE</p>"
 done
 
-
-# finalise output file
-
-cat ../templates/hints/list-bottom.html >> $OUTPUTFILE
-

Modified: scripts/trunk/update-website.mk
===================================================================
--- scripts/trunk/update-website.mk	2005-06-23 13:10:54 UTC (rev 325)
+++ scripts/trunk/update-website.mk	2005-06-26 00:28:50 UTC (rev 326)
@@ -129,7 +129,7 @@
 	fi
 
 hints-list:
-	#cd hints && $(SCRIPTS)/genlist.sh
+	cd hints && $(SCRIPTS)/genlist.sh
 
 # Validate XHTML files
 # FIXME: better on a pre-commit script?




More information about the website mailing list