diff options
author | Daiki Ueno <ueno@gnu.org> | 2015-12-10 16:34:52 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2015-12-10 16:36:59 +0900 |
commit | 031cc2acb69c48d4e36158cf24f73e732522ac79 (patch) | |
tree | 2710749c76e3c3cc019647539fd74d5e37221ac5 /gettext-tools | |
parent | 660d9c6bc56624bc6ecd63555009fd1de36d2269 (diff) | |
download | external_gettext-031cc2acb69c48d4e36158cf24f73e732522ac79.zip external_gettext-031cc2acb69c48d4e36158cf24f73e732522ac79.tar.gz external_gettext-031cc2acb69c48d4e36158cf24f73e732522ac79.tar.bz2 |
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.
Diffstat (limited to 'gettext-tools')
-rw-r--r-- | gettext-tools/src/its.c | 5 | ||||
-rwxr-xr-x | gettext-tools/tests/xgettext-its-1 | 21 |
2 files changed, 25 insertions, 1 deletions
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 <gt:contextRule selector="//msg:p[@context = 'yes']" contextPointer="substring-before(., '|')" textPointer="substring-after(., '|')"/> + + <gt:escapeRule selector="//msg:message/*[@unescape = 'yes']" escape="no"/> + + <its:translateRule selector="//msg:message/@unescaped" translate="yes"/> + <gt:escapeRule selector="//msg:message/@unescaped" escape="no"/> </its:rules> EOF @@ -160,6 +165,12 @@ cat <<\EOF >messages.xml but not middle </p> </message> + <message> + <p unescape="yes">This is an unescaped element <>&"</p> + </message> + <message unescaped="This is an unescaped attribute <>&""> + <p></p> + </message> </messages> 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} |