chiark / gitweb /
Fix up validation scripts so that they more or less work: don't hardcode
authorColin Watson <cjwatson@chiark.greenend.org.uk>
Tue, 10 Sep 2002 09:20:53 +0000 (09:20 +0000)
committerColin Watson <cjwatson@chiark.greenend.org.uk>
Tue, 10 Sep 2002 09:20:53 +0000 (09:20 +0000)
the hostname, don't try to validate things in .svn directories, and do the
right thing with XHTML.

validate-directory
validate-tree

index 4ecbc67a3061881fc0fbeb785ad46f6d4bec6eac..6615bef29099ae327222a436d2b22267b96aa1cb 100755 (executable)
@@ -1,10 +1,20 @@
 #! /bin/bash
 
+HOST="`hostname`"
+
 set -e
 [ "$1" ] && cd $1
-BASE_URL=`pwd -P | sed 's|/home/httpd/users/|http://riva.ucam.org/~|'`
+BASE_URL=`pwd -P | sed 's|/home/\([^/]*\)/public_html/|http://'"$HOST"'/~\1/|'`
 set +e
 
 shopt -s nullglob
-for x in *.html; do echo $BASE_URL/$x; nsgmls -s $BASE_URL/$x; done
-
+for x in *.html; do
+    echo "$BASE_URL/$x"
+    if head -1 "$x" | egrep -q '(xml|XHTML)'; then
+       SP_CHARSET_FIXED=YES SP_ENCODING=XML \
+           SGML_CATALOG_FILES=/usr/share/sgml/declaration/xml.soc \
+           nsgmls -wxml -s "$BASE_URL/$x"
+    else
+       nsgmls -s "$BASE_URL/$x"
+    fi
+done
index d8c5766ea7c22929faaddbc4159d3b165002a602..d6022bec8fd18c822c41ff3c4a3beaf5ca78b231 100755 (executable)
@@ -4,4 +4,4 @@ set -e
 [ "$1" ] && cd $1
 set +e
 
-find -type d -perm -0755 | sort | xargs -n 1 validate-directory
+find -type d -perm -0755 | fgrep -v .svn | sort | xargs -n 1 validate-directory