From 031cc2acb69c48d4e36158cf24f73e732522ac79 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Thu, 10 Dec 2015 16:34:52 +0900 Subject: xgettext: Respect ITS escape rule for attributes * gettext-tools/src/its.c (its_rule_list_extract_text): Check for "escape" value for an attribute node. * gettext-tools/tests/xgettext-its-1: Add tests for gt:escapeRule. --- gettext-tools/src/its.c | 5 ++++- gettext-tools/tests/xgettext-its-1 | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gettext-tools/src/its.c b/gettext-tools/src/its.c index 394b5f0..a1d7843 100644 --- a/gettext-tools/src/its.c +++ b/gettext-tools/src/its.c @@ -1661,10 +1661,13 @@ its_rule_list_extract_text (its_rule_list_ty *rules, comment = xstrdup (value); else { + value = its_value_list_get_value (values, "escape"); + no_escape = value != NULL && strcmp (value, "no") == 0; + value = its_value_list_get_value (values, "locNotePointer"); if (value) comment = _its_get_content (rules, node, value, ITS_WHITESPACE_TRIM, - false); + no_escape); } if (comment != NULL && *comment != '\0') diff --git a/gettext-tools/tests/xgettext-its-1 b/gettext-tools/tests/xgettext-its-1 index 26a149c..9e3cac5 100755 --- a/gettext-tools/tests/xgettext-its-1 +++ b/gettext-tools/tests/xgettext-its-1 @@ -99,6 +99,11 @@ cat <<\EOF > its/messages.its + + + + + EOF @@ -160,6 +165,12 @@ cat <<\EOF >messages.xml but not middle

+ +

This is an unescaped element <>&"

+
+ +

+
EOF @@ -226,6 +237,16 @@ msgid "" "Leading/trailing whitespaces are removed,\n" " but not middle" msgstr "" + +#. (itstool) path: message/p +#: messages.xml:59 +msgid "This is an unescaped element <>&\"" +msgstr "" + +#. (itstool) path: messages/message@unescaped +#: messages.xml:61 +msgid "This is an unescaped attribute <>&\"" +msgstr "" EOF : ${DIFF=diff} -- cgit v1.1