[beast] BUILD: properly escape multiline XML strings in intlfix-xml.awk
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast] BUILD: properly escape multiline XML strings in intlfix-xml.awk
- Date: Tue, 7 Sep 2010 02:00:47 +0000 (UTC)
commit aea35f9a992603f6813beee3ef5efce7d81ffb59
Author: Tim Janik <timj gtk org>
Date: Mon Sep 6 21:37:19 2010 +0200
BUILD: properly escape multiline XML strings in intlfix-xml.awk
autotools/intlfix-xml.awk | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/autotools/intlfix-xml.awk b/autotools/intlfix-xml.awk
index 6012b2b..079a33a 100644
--- a/autotools/intlfix-xml.awk
+++ b/autotools/intlfix-xml.awk
@@ -25,11 +25,13 @@ BEGIN {
}
#print ""
} else if (XMLEVENT == "COMMENT") {
- gsub ("\\*/", "* /", XMLNAME)
+ gsub ("\\*/", "* /", XMLNAME) # escape enclosed C-comment ends
ostring = sprintf ("/* %s */\n", XMLNAME)
printf ("__XML_LINE__%-3d: %s", OLINE, ostring); gsub (/[^\n]/, "", ostring); OLINE += length (ostring)
} else if (XMLEVENT == "CHARDATA" && match (TAG, "^_[^_]")) {
- sub ("^_", "", TAG); gsub ("[\\\"]", "\\" "\\&", XMLNAME)
+ gsub ("[\\\"]", "\\" "\\&", XMLNAME) # escape string quotes
+ gsub (/\n/, "\\n\"\n\"", XMLNAME) # escape newlines
+ sub ("^_", "", TAG)
ostring = sprintf ("%s /*<%s/>*/_(\"%s\");\n", MARKER, TAG, XMLNAME);
printf ("__XML_LINE__%-3d: %s", OLINE, ostring); gsub (/[^\n]/, "", ostring); OLINE += length (ostring)
} else if (XMLEVENT == "ENDELEM") {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]