[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
trans-coord/gnun/prep/gnun validate-html ChangeLog
From: |
Kaloian Doganov |
Subject: |
trans-coord/gnun/prep/gnun validate-html ChangeLog |
Date: |
Fri, 08 Feb 2008 17:32:27 +0000 |
CVSROOT: /sources/trans-coord
Module name: trans-coord
Changes by: Kaloian Doganov <kaloian> 08/02/08 17:32:27
Modified files:
gnun/prep/gnun : validate-html ChangeLog
Log message:
validate-html: Enrich xmllint's error messages with additional
context lines from the input file.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/prep/gnun/validate-html?cvsroot=trans-coord&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/prep/gnun/ChangeLog?cvsroot=trans-coord&r1=1.37&r2=1.38
Patches:
Index: validate-html
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/prep/gnun/validate-html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- validate-html 6 Feb 2008 20:58:30 -0000 1.5
+++ validate-html 8 Feb 2008 17:32:27 -0000 1.6
@@ -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,36 @@
ROOT=`dirname $0`/../..
USERDTD=$HOME/dtd
+# Create two tempfiles and mark them for deletion on exit.
+TMP1=`mktemp -t gnun.1.XXXXXX`
+TMP2=`mktemp -t gnun.2.XXXXXX`
+trap "rm -f $TMP1 $TMP2" EXIT
+
+# Expand input file's #include directives and save the result in
+# $TMP1.
cat $1 | sed "s/<\!--#include virtual=\"\/\?\(.*\)\" -->/include(\`\1')/g" \
- | m4 -EE -I $ROOT | xmllint --path "$USERDTD" --loaddtd --nonet --noout -
+ | m4 -EE -I $ROOT > $TMP1
+
+# Execute xmllint on $TMP1 and save it's output to $TMP2.
+set +o pipefail
+set +e
+cat $TMP1 | xmllint --path "$USERDTD" --loaddtd --nonet --noout - 2> $TMP2
+LINTSTATUS=$?
+set -e
+set -o pipefail
+
+# Parse xmllint's error output (if any) and print it by inserting
+# additional context line after every occurrence of "line X" where X
+# is a decimal number. It is helpful to show the contents of those
+# mentioned lines, since xmllint runs on intermediate input file (with
+# expanded #include directives) and the translator can not easily look
+# up for references in it.
+cat $TMP2 | sed '
+ /line [[:digit:]]\+/ {
+ p
+ s=^.*line \([[:digit:]]\+\).*$=head -n \1 '"$TMP1"' | tail -n 1=
+ e
+ }'
+
+# Exit with xmlint's original exit status.
+exit $LINTSTATUS
Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/prep/gnun/ChangeLog,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- ChangeLog 8 Feb 2008 14:52:34 -0000 1.37
+++ ChangeLog 8 Feb 2008 17:32:27 -0000 1.38
@@ -1,3 +1,8 @@
+2008-02-08 Kaloian Doganov <address@hidden>
+
+ * validate-html: Enrich xmllint's error messages with additional
+ context lines from the input file.
+
2008-02-08 Yavor Doganov <address@hidden>
Implement validation for PO files.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- trans-coord/gnun/prep/gnun validate-html ChangeLog,
Kaloian Doganov <=