X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?p=bin.git;a=blobdiff_plain;f=validate-directory;h=a0164ed890774a5f91d305805467350cfb3c8883;hp=4ecbc67a3061881fc0fbeb785ad46f6d4bec6eac;hb=e470a222375a6f1b03b3bb72d9b2b994da8de8bb;hpb=88c7e302a60194f68bc1b6d20c1547b62e1436d3 diff --git a/validate-directory b/validate-directory old mode 100644 new mode 100755 index 4ecbc67..a0164ed --- a/validate-directory +++ b/validate-directory @@ -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 -n 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