[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] gnun-validate-html may break on ASCII art
From: |
Ineiev |
Subject: |
[PATCH] gnun-validate-html may break on ASCII art |
Date: |
Thu, 18 Aug 2011 15:32:00 +0000 |
User-agent: |
Thunderbird 2.0.0.14 (X11/20080501) |
Hi,
gnun-validate-html expands the SSIs substituting the include
with m4_include and processing the file with m4.
The intermediate file may confuse m4 when it contains ASCII art,
like /graphics/alternative-ascii.html.
It is suggested that the SSIs may be expanded via recursive
awk script; by the way, configuration time variables for
awk and sed programs are used like the variable for m4 in the
current version of gnun-validate-html is used.
Any ideas?
Index: gnun-validate-html.in
===================================================================
RCS file:
/sources/trans-coord/trans-coord/gnun/server/gnun/gnun-validate-html.in,v
retrieving revision 1.9
diff -U 2 -r1.9 gnun-validate-html.in
--- gnun-validate-html.in 7 Jan 2010 14:43:04 -0000 1.9
+++ gnun-validate-html.in 18 Aug 2011 15:22:38 -0000
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
# This file is part of GNUnited Nations.
@@ -21,5 +21,5 @@
cat <<EOF
gnun-validate-html (@PACKAGE_NAME@) @PACKAGE_VERSION@
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2011 Free Software Foundation, Inc.
You may redistribute copies of @PACKAGE_NAME@
under the terms of the GNU General Public License.
@@ -72,15 +72,33 @@
trap "rm -f $TMP1 $TMP2 $TMP3" EXIT
+cat > $TMP3 <<"EOF"
+/<!--#include virtual/ {
+ n = split ($0, names, "<!--#include virtual=\"");
+ printf ("%s", names[1]);
+ for (i = 2; i <= n; i++)
+ {
+ m = split (names[i], rest, "-->");
+ name = rest[1];
+ gsub ("\"[^\"]*$", "", name);
+ gsub ("^", root, name);
+ system ("@AWK@ -v script_name='" script_name "' -v root='" \
+ root "' -f '" script_name "' " name);
+ for (j = 2; j <= m; j++)
+ {
+ printf ("%s", rest[j]);
+ if (j < m)
+ print ("-->");
+ }
+ }
+ next;
+}
+
+{ print; }
+EOF
+
# Expand input file's #include directives and save the result in
# $TMP1.
-cat $1 > $TMP1
-while true; do
- grep --quiet '<!--#include virtual' $TMP1 || break
- sed --in-place \
- "s/<\!--#include virtual=\"\/\?\(.*\)\" -->/m4_include(\`\1')/g" $TMP1
- @M4@ -P -EE -I $ROOT $TMP1 > $TMP3
- cp $TMP3 $TMP1
-done
address@hidden@ -v script_name=$TMP3 -v root="$ROOT" -f $TMP3 $1 > $TMP1
# Execute xmllint on $TMP1 and save its output to $TMP2.
@@ -98,5 +116,5 @@
# expanded #include directives) and the translator can not easily look
# up for references in it.
-cat $TMP2 | sed '
+cat $TMP2 | @SED@ '
/line [[:digit:]]\+/ {
p
Index: Makefile.am
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/Makefile.am,v
retrieving revision 1.17
diff -U 2 -r1.17 Makefile.am
--- Makefile.am 2 Aug 2010 13:54:11 -0000 1.17
+++ Makefile.am 18 Aug 2011 15:22:38 -0000
@@ -1,3 +1,3 @@
-# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
# This file is part of GNUnited Nations.
@@ -35,4 +35,5 @@
noinst_SCRIPTS = stamp-config.mk
+pkglibexecdir = $(datadir)/libexec
pkglibexec_SCRIPTS = validate-html-notify
@@ -52,5 +53,8 @@
-e 's|@address@hidden|$(prefix)|g' \
-e 's|@address@hidden|$(pkglibexecdir)|g' \
- -e 's|@address@hidden|$(M4)|g'
+ -e 's|@address@hidden|$(AWK)|g' \
+ -e 's|@address@hidden|$(GREP)|g' \
+ -e 's|@address@hidden|$(M4)|g' \
+ -e 's|@address@hidden|$(SED)|g'
gnun-validate-html validate-html-notify: Makefile
- [PATCH] gnun-validate-html may break on ASCII art,
Ineiev <=