Hello community,

here is the log from the commit of package python-html5-parser for 
openSUSE:Factory checked in at 2020-04-09 23:17:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-html5-parser (Old)
 and      /work/SRC/openSUSE:Factory/.python-html5-parser.new.3248 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-html5-parser"

Thu Apr  9 23:17:43 2020 rev:9 rq:792714 version:0.4.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-html5-parser/python-html5-parser.changes  
2019-09-27 14:45:54.417161285 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-html5-parser.new.3248/python-html5-parser.changes
        2020-04-09 23:18:12.278339878 +0200
@@ -1,0 +2,7 @@
+Thu Apr  9 11:12:17 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- Update to 0.4.9
+  * Fix an error parsing XHTML where the xlink namespace is defined on 
+    the root node but not on a node where the default namespace is redefined
+
+-------------------------------------------------------------------

Old:
----
  python-html5-parser-0.4.8.tar.gz

New:
----
  python-html5-parser-0.4.9.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-html5-parser.spec ++++++
--- /var/tmp/diff_new_pack.tv7eQT/_old  2020-04-09 23:18:12.954340269 +0200
+++ /var/tmp/diff_new_pack.tv7eQT/_new  2020-04-09 23:18:12.954340269 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-html5-parser
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-html5-parser
-Version:        0.4.8
+Version:        0.4.9
 Release:        0
 Summary:        C based HTML 5 parsing for Python
 License:        Apache-2.0
@@ -48,6 +48,9 @@
 %install
 %python_install
 
+%check
+%python_exec setup.py test
+
 %files %{python_files}
 %license LICENSE
 %doc README.rst

++++++ python-html5-parser-0.4.8.tar.gz -> python-html5-parser-0.4.9.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/html5-parser-0.4.8/src/as-libxml.c 
new/html5-parser-0.4.9/src/as-libxml.c
--- old/html5-parser-0.4.8/src/as-libxml.c      2019-07-25 08:02:44.000000000 
+0200
+++ new/html5-parser-0.4.9/src/as-libxml.c      2019-11-03 04:13:38.000000000 
+0100
@@ -50,14 +50,25 @@
 static inline xmlNsPtr
 ensure_xml_ns(xmlDocPtr doc, ParseData *pd, xmlNodePtr node) {
     // By default libxml2 docs do not have the xml: namespace defined.
-    xmlNodePtr root = pd->root ? pd->root : node;
     if (UNLIKELY(!pd->xml)) {
+        xmlNodePtr root = pd->root ? pd->root : node;
         pd->xml = xmlSearchNs(doc, root, BAD_CAST "xml");
     }
     return pd->xml;
 }
 
 static inline xmlNsPtr
+ensure_xlink_ns(xmlDocPtr doc, ParseData *pd, xmlNodePtr node) {
+    if (UNLIKELY(!pd->xlink)) {
+        xmlNodePtr root = pd->root ? pd->root : node;
+        pd->xlink = xmlSearchNs(doc, root, BAD_CAST "xlink");
+        if (UNLIKELY(!pd->xlink)) pd->xlink = xmlNewNs(root, BAD_CAST 
"http://www.w3.org/1999/xlink";, BAD_CAST "xlink");
+    }
+    return pd->xlink;
+}
+
+
+static inline xmlNsPtr
 find_namespace_by_prefix(xmlDocPtr doc, xmlNodePtr node, xmlNodePtr 
xml_parent, const char* prefix) {
     xmlNsPtr ans = xmlSearchNs(doc, node, BAD_CAST prefix);
     if (ans) return ans;
@@ -75,7 +86,6 @@
     char buf[50] = {0};
     ParseData *pd = (ParseData*)doc->_private;
     xmlNsPtr ns;
-    xmlNodePtr root;
     int added_lang = 0;
 
     for (unsigned int i = 0; i < elem->attributes.length; ++i) {
@@ -85,12 +95,8 @@
         ns = NULL;
         switch (attr->attr_namespace) {
             case GUMBO_ATTR_NAMESPACE_XLINK:
-                root = pd->root ? pd->root : node;
-                if (UNLIKELY(!pd->xlink)) {
-                    pd->xlink = xmlNewNs(root, BAD_CAST 
"http://www.w3.org/1999/xlink";, BAD_CAST "xlink");
-                    if(UNLIKELY(!pd->xlink)) return false;
-                }
-                ns = pd->xlink;
+                ns = ensure_xlink_ns(doc, pd, node);
+                if (UNLIKELY(!ns)) return false;
                 break;
             case GUMBO_ATTR_NAMESPACE_XML:
                 ns = ensure_xml_ns(doc, pd, node);
@@ -105,11 +111,7 @@
                 break;
             case GUMBO_ATTR_NAMESPACE_XMLNS:
                 if (strncmp(aname, "xlink", 5) == 0) {
-                    root = pd->root ? pd->root : node;
-                    if (UNLIKELY(!pd->xlink)) {
-                        pd->xlink = xmlNewNs(root, BAD_CAST 
"http://www.w3.org/1999/xlink";, BAD_CAST "xlink");
-                        if(UNLIKELY(!pd->xlink)) return false;
-                    }
+                    if (!ensure_xlink_ns(doc, pd, node)) return false;
                     // We ignore the value of this attribute since we dont want
                     // the xlink namespace to be redefined
                     continue;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/html5-parser-0.4.8/src/python-wrapper.c 
new/html5-parser-0.4.9/src/python-wrapper.c
--- old/html5-parser-0.4.8/src/python-wrapper.c 2019-07-25 08:02:44.000000000 
+0200
+++ new/html5-parser-0.4.9/src/python-wrapper.c 2019-11-03 04:13:38.000000000 
+0100
@@ -15,7 +15,7 @@
 
 #define MAJOR 0
 #define MINOR 4
-#define PATCH 8
+#define PATCH 9
 
 static char *NAME =  "libxml2:xmlDoc";
 static char *DESTRUCTOR = "destructor:xmlFreeDoc";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/html5-parser-0.4.8/test/namespace.py 
new/html5-parser-0.4.9/test/namespace.py
--- old/html5-parser-0.4.8/test/namespace.py    2019-07-25 08:02:44.000000000 
+0200
+++ new/html5-parser-0.4.9/test/namespace.py    2019-11-03 04:13:38.000000000 
+0100
@@ -177,3 +177,12 @@
         a = p[0]
         self.ae(a.attrib, {'{1}a': 'a', '{2}a': 'b', 'n': 'm'})
         self.ae(a.tag, '{1}one')
+
+    def test_xlink(self):
+        src = '''<html xmlns:xlink="xl"><svg><image xlink:href="x"/>'''
+        root = parse(src, maybe_xhtml=True)
+        self.ae(
+            tostring(root),
+            '''<html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:xlink="xl"><head/><body>\
+<svg xmlns="http://www.w3.org/2000/svg";><image 
xlink:href="x"/></svg></body></html>'''
+        )


Reply via email to