trans-coord-devel
[Top][All Lists]
Advanced

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

Re: home.shtml: Make checks whether the HTML is decently generated.


From: Kaloian Doganov
Subject: Re: home.shtml: Make checks whether the HTML is decently generated.
Date: Fri, 08 Feb 2008 16:59:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gNewSense gnu/linux)

    Is there a chance to improve the situation?

Please try the following patch:

Index: prep/gnun/validate-html
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/prep/gnun/validate-html,v
retrieving revision 1.5
diff -u -r1.5 validate-html
--- prep/gnun/validate-html     6 Feb 2008 20:58:30 -0000       1.5
+++ prep/gnun/validate-html     8 Feb 2008 14:55:37 -0000
@@ -18,6 +18,7 @@
 # along with GNUnited Nations.  If not, see <http://www.gnu.org/licenses/>.
 
 set -e
+set -o pipefail
 
 if [ $# -ne 1 ]; then
     echo 1>&2 Error: The script requires a FILE as argument.
@@ -27,5 +28,25 @@
 ROOT=`dirname $0`/../..
 USERDTD=$HOME/dtd
 
+TMP1=`mktemp -t gnun.1.XXXXXX`
+TMP2=`mktemp -t gnun.2.XXXXXX`
+
+trap "rm -f $TEMPFILE1 $TEMPFILE2" EXIT
+
 cat $1 | sed "s/<\!--#include virtual=\"\/\?\(.*\)\" -->/include(\`\1')/g" \
-  | m4 -EE -I $ROOT | xmllint --path "$USERDTD" --loaddtd --nonet --noout -
+  | m4 -EE -I $ROOT > $TMP1
+
+set +o pipefail
+set +e
+cat $TMP1 | xmllint --path "$USERDTD" --loaddtd --nonet --noout - 2> $TMP2
+LINTSTATUS=$?
+set -e
+set -o pipefail
+
+cat $TMP2 | sed '
+  /line [[:digit:]]\+/ {
+     p
+     s=^.*line \([[:digit:]]\+\).*$=head -n \1 '"$TMP1"' | tail -n 1=
+     e
+  }'
+exit $LINTSTATUS




reply via email to

[Prev in Thread] Current Thread [Next in Thread]