Imported Upstream version 1.1.1 55/195155/1 upstream/1.1.1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 11 Dec 2018 07:07:19 +0000 (16:07 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 11 Dec 2018 07:07:19 +0000 (16:07 +0900)
Change-Id: I163910daa72460ea1f0c74a64acd405d25dd64e5
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
ChangeLog
NEWS
configure
configure.ac
itstool
itstool.1
itstool.in

index 23df2c4f1583dc9acaf28c1cf115f9a1c1480e86..d2423594e4c37e14f418c05655ac715817b753a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,69 @@
+commit 0520144626db679e81725aebfaba273a52fd0bf4
+Merge: 092a264 7e07396
+Author: Shaun McCance <shaunm@gnome.org>
+Date:   Sat Sep 3 13:21:09 2011 -0400
+
+    Merge: Proper XML error catching [claude]
+
+commit 092a26470a5032c85ba8a40570ee6fd6c9fe9b30
+Merge: c3566db 48e4257
+Author: Shaun McCance <shaunm@gnome.org>
+Date:   Sat Sep 3 13:10:19 2011 -0400
+
+    Merge commit '48e4257421beb439f23a78507f43aae694775974'
+
+commit c3566dbec79ecd2d0bbef5b42044d7b12380c034
+Merge: 6e6ca0d 6411b09
+Author: Shaun McCance <shaunm@gnome.org>
+Date:   Sat Sep 3 10:56:58 2011 -0400
+
+    Merge commit 'refs/merge-requests/2' of git://gitorious.org/itstool/itstool
+
+commit 7e0739641507d92e1d2ec7e9b7f5e5c7c09a940a
+Author: Claude Paroz <claude@2xlibre.net>
+Date:   Wed Aug 17 13:32:42 2011 +0200
+
+    Catch XML errors in translated content
+
+ itstool.in                   |    1 +
+ tests/Translate3.ll.wrong.po |   19 +++++++++++++++++++
+ tests/run_tests.py           |   24 ++++++++++++++++++------
+ 3 files changed, 38 insertions(+), 6 deletions(-)
+
+commit 1abdf1b0d83b37a9f298563e139c118c9a62629b
+Author: Claude Paroz <claude@2xlibre.net>
+Date:   Wed Aug 17 12:10:36 2011 +0200
+
+    Catch XML parsing errors so itstool does properly exit with error code
+
+ itstool.in          |   10 ++++++++++
+ tests/Malformed.xml |    6 ++++++
+ tests/run_tests.py  |   18 ++++++++++++------
+ 3 files changed, 28 insertions(+), 6 deletions(-)
+
+commit 6411b09431eb72ed5426d40a0142e7479c486d3b
+Author: Claude Paroz <claude@2xlibre.net>
+Date:   Wed Jun 29 21:15:46 2011 +0200
+
+    Fix placeholder translation when it contains sub-elements
+
+ itstool.in               |   12 ++++++++++--
+ tests/Placeholder.ll.po  |   19 +++++++++++++++++++
+ tests/Placeholder.ll.xml |    6 ++++++
+ tests/Placeholder.xml    |    5 +++++
+ tests/run_tests.py       |    4 +++-
+ 5 files changed, 43 insertions(+), 3 deletions(-)
+
+commit 6e6ca0daf4084aaa94268f062461e1ec712698fa
+Author: Shaun McCance <shaunm@gnome.org>
+Date:   Mon Jun 27 14:59:56 2011 -0400
+
+    Version 1.1.0
+
+ NEWS         |   14 ++++++++++++++
+ configure.ac |    2 +-
+ 2 files changed, 15 insertions(+), 1 deletions(-)
+
 commit 187fcbe585560f128c7436e66f6b8e3a789a73b0
 Author: Shaun McCance <shaunm@gnome.org>
 Date:   Sun Jun 26 12:28:10 2011 -0400
@@ -353,6 +419,17 @@ Date:   Tue Apr 26 16:22:24 2011 -0400
  itstool |   12 ++++++++++++
  1 files changed, 12 insertions(+), 0 deletions(-)
 
+commit 48e4257421beb439f23a78507f43aae694775974
+Author: Javier Jardón <jjardon@gnome.org>
+Date:   Tue Apr 26 17:00:23 2011 +0100
+
+    autogen.sh: Improve script to handle out of tree compilations
+    
+    Also handle the option to not run the configure step
+
+ autogen.sh |    7 +++++--
+ 1 files changed, 5 insertions(+), 2 deletions(-)
+
 commit 65ecbc8856e91b991d812e08dfa10300504bfb1b
 Author: Shaun McCance <shaunm@gnome.org>
 Date:   Tue Apr 26 11:33:03 2011 -0400
diff --git a/NEWS b/NEWS
index 32cdcc4838b9c6abef150e20c44ad1ae219245cf..3795d699736e412cb4d417a8b46714494e6c93e4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+1.1.1
+=====
+* Catch XML parsing errors and exit with error code
+* Fixed placeholder translation when it contains sub-elements
+* Improved autogen.sh for out of tree compilations
+* Commits by Claude Paroz, Javier Jardón
+
 1.1.0
 =====
 * Added itst:context to set msgctxt
index 738537a61897a509cd9d9b8a582fb1235bb8577e..1ad36643a0f0be12bea537817b485ad6c47bc763 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.66 for itstool 1.1.0.
+# Generated by GNU Autoconf 2.66 for itstool 1.1.1.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -548,8 +548,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='itstool'
 PACKAGE_TARNAME='itstool'
-PACKAGE_VERSION='1.1.0'
-PACKAGE_STRING='itstool 1.1.0'
+PACKAGE_VERSION='1.1.1'
+PACKAGE_STRING='itstool 1.1.1'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1165,7 +1165,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures itstool 1.1.0 to adapt to many kinds of systems.
+\`configure' configures itstool 1.1.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1231,7 +1231,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of itstool 1.1.0:";;
+     short | recursive ) echo "Configuration of itstool 1.1.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1298,7 +1298,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-itstool configure 1.1.0
+itstool configure 1.1.1
 generated by GNU Autoconf 2.66
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1315,7 +1315,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by itstool $as_me 1.1.0, which was
+It was created by itstool $as_me 1.1.1, which was
 generated by GNU Autoconf 2.66.  Invocation command line was
 
   $ $0 $@
@@ -2130,7 +2130,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='itstool'
- VERSION='1.1.0'
+ VERSION='1.1.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2726,7 +2726,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by itstool $as_me 1.1.0, which was
+This file was extended by itstool $as_me 1.1.1, which was
 generated by GNU Autoconf 2.66.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2779,7 +2779,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-itstool config.status 1.1.0
+itstool config.status 1.1.1
 configured by $0, generated by GNU Autoconf 2.66,
   with options \\"\$ac_cs_config\\"
 
index 7601dfe6595a270746344a51402c4e676000ef21..1e73bdb7dd9692ab6c6167bef7bd786d6bbde704 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT([itstool], [1.1.0], [])
+AC_INIT([itstool], [1.1.1], [])
 AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2])
 
 DATADIR=`(
diff --git a/itstool b/itstool
index 3492abdf10b3d1f7d4791ca453c03a3596f98509..ad19c0040aaeb2016d37930c5855dfc200655504 100644 (file)
--- a/itstool
+++ b/itstool
@@ -17,7 +17,7 @@
 # Place, Suite 330, Boston, MA  0211-1307  USA.
 #
 
-VERSION="1.1.0"
+VERSION="1.1.1"
 DATADIR="/usr/local/share"
 
 import gettext
@@ -287,9 +287,14 @@ def xml_is_ns_name (node, ns, name):
         return False
     return node.name == name and node.ns() is not None and node.ns().content == ns
 
+def xml_error_catcher(doc, error):
+    doc._xml_err += " %s" % error
+
 
 class Document (object):
     def __init__ (self, filename, messages):
+        self._xml_err = ''
+        libxml2.registerErrorHandler(xml_error_catcher, self)
         ctxt = libxml2.createFileParserCtxt(filename)
         ctxt.lineNumbers(1)
         ctxt.replaceEntities(1)
@@ -313,6 +318,7 @@ class Document (object):
                     self._localrules.append(child)
                 pre_process(child)
         pre_process(self._doc)
+        self._check_errors()
         self._msgs = messages
         self._its_translate_nodes = {}
         self._its_within_text_nodes = {}
@@ -325,6 +331,10 @@ class Document (object):
         self._itst_credits = None
         self._itst_externals = []
 
+    def _check_errors(self):
+        if self._xml_err:
+            raise libxml2.parserError(self._xml_err)
+
     def apply_its_rule(self, rule, xpath):
         if rule.type != 'element':
             return
@@ -644,6 +654,7 @@ class Document (object):
                     if child.type == 'element':
                         fix_node_ns(child, childnsdefs)
             fix_node_ns(node, {})
+            self._check_errors()
 
     def translate_attrs(self, oldnode, newnode):
         trans_attrs = [attr for attr in xml_attr_iter(oldnode) if self._its_translate_nodes.get(attr, 'no') == 'yes']
@@ -692,8 +703,13 @@ class Document (object):
                 if child.type != 'element':
                     continue
                 if child.ns() is not None and child.ns().content == NS_BLANK:
-                    repl = self.get_translated(msg.get_placeholder(child.name).node, translations)
-                    child.replaceNode(repl)
+                    ph_node = msg.get_placeholder(child.name).node
+                    if self.has_child_elements(ph_node):
+                        self.merge_translations(translations, None, ph_node)
+                        child.replaceNode(ph_node)
+                    else:
+                        repl = self.get_translated(ph_node, translations)
+                        child.replaceNode(repl)
                 scan_node(child)
         scan_node(trnode)
         retnode = node.copyNode(2)
@@ -802,6 +818,9 @@ class Document (object):
     def is_translation_unit (self, node):
         return self.get_its_within_text(node) != 'yes'
 
+    def has_child_elements(self, node):
+        return len([child for child in xml_child_iter(node) if child.type=='element'])
+
     def get_preserve_space (self, node):
         if node.getSpacePreserve() == 1:
             return True
index 7e8f1de28fc8af982d4aa82db2273c96d92b4d72..d1cd5060262de0bc475538b600ebbe19db5f267a 100644 (file)
--- a/itstool.1
+++ b/itstool.1
@@ -1,4 +1,4 @@
-.TH ITSTOOL "1" "May 2011" "itstool 1.1.0"
+.TH ITSTOOL "1" "May 2011" "itstool 1.1.1"
 .SH NAME
 itstool \- convert between XML and PO using ITS
 
index 24019182117df69c0d94b420d59c5588c939636d..d0510a9d821c0f5aeed3834de28360166aaac734 100755 (executable)
@@ -287,9 +287,14 @@ def xml_is_ns_name (node, ns, name):
         return False
     return node.name == name and node.ns() is not None and node.ns().content == ns
 
+def xml_error_catcher(doc, error):
+    doc._xml_err += " %s" % error
+
 
 class Document (object):
     def __init__ (self, filename, messages):
+        self._xml_err = ''
+        libxml2.registerErrorHandler(xml_error_catcher, self)
         ctxt = libxml2.createFileParserCtxt(filename)
         ctxt.lineNumbers(1)
         ctxt.replaceEntities(1)
@@ -313,6 +318,7 @@ class Document (object):
                     self._localrules.append(child)
                 pre_process(child)
         pre_process(self._doc)
+        self._check_errors()
         self._msgs = messages
         self._its_translate_nodes = {}
         self._its_within_text_nodes = {}
@@ -325,6 +331,10 @@ class Document (object):
         self._itst_credits = None
         self._itst_externals = []
 
+    def _check_errors(self):
+        if self._xml_err:
+            raise libxml2.parserError(self._xml_err)
+
     def apply_its_rule(self, rule, xpath):
         if rule.type != 'element':
             return
@@ -644,6 +654,7 @@ class Document (object):
                     if child.type == 'element':
                         fix_node_ns(child, childnsdefs)
             fix_node_ns(node, {})
+            self._check_errors()
 
     def translate_attrs(self, oldnode, newnode):
         trans_attrs = [attr for attr in xml_attr_iter(oldnode) if self._its_translate_nodes.get(attr, 'no') == 'yes']
@@ -692,8 +703,13 @@ class Document (object):
                 if child.type != 'element':
                     continue
                 if child.ns() is not None and child.ns().content == NS_BLANK:
-                    repl = self.get_translated(msg.get_placeholder(child.name).node, translations)
-                    child.replaceNode(repl)
+                    ph_node = msg.get_placeholder(child.name).node
+                    if self.has_child_elements(ph_node):
+                        self.merge_translations(translations, None, ph_node)
+                        child.replaceNode(ph_node)
+                    else:
+                        repl = self.get_translated(ph_node, translations)
+                        child.replaceNode(repl)
                 scan_node(child)
         scan_node(trnode)
         retnode = node.copyNode(2)
@@ -802,6 +818,9 @@ class Document (object):
     def is_translation_unit (self, node):
         return self.get_its_within_text(node) != 'yes'
 
+    def has_child_elements(self, node):
+        return len([child for child in xml_child_iter(node) if child.type=='element'])
+
     def get_preserve_space (self, node):
         if node.getSpacePreserve() == 1:
             return True