[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comme
From: |
Lars Ingebrigtsen |
Subject: |
bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument |
Date: |
Sat, 14 Apr 2018 00:54:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
I tried the following, but it's not correct, since it resulted in
(html nil (body nil (p nil "This " nil " that")))
But what should the result be here?
(html nil (body nil (p nil "This that")))
or
(html nil (body nil (p nil "This " " that")))
?
I think the former... Which means that you'd have to do some major
doctoring of the structures, I think?
diff --git a/src/xml.c b/src/xml.c
index 42059d7713..bf416407da 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -119,7 +119,7 @@ init_libxml2_functions (void)
}
static Lisp_Object
-make_dom (xmlNode *node)
+make_dom (xmlNode *node, bool discard_comments)
{
if (node->type == XML_ELEMENT_NODE)
{
@@ -148,7 +148,7 @@ make_dom (xmlNode *node)
child = node->children;
while (child != NULL)
{
- result = Fcons (make_dom (child), result);
+ result = Fcons (make_dom (child, discard_comments), result);
child = child->next;
}
@@ -163,7 +163,7 @@ make_dom (xmlNode *node)
}
else if (node->type == XML_COMMENT_NODE)
{
- if (node->content)
+ if (node->content && ! discard_comments)
return list3 (intern ("comment"), Qnil,
build_string ((char *) node->content));
else
@@ -239,7 +239,7 @@ parse_region (Lisp_Object start, Lisp_Object end,
Lisp_Object base_url,
while (n) {
if (!NILP (r))
result = Fcons (r, result);
- r = make_dom (n);
+ r = make_dom (n, false);
n = n->next;
}
}
@@ -249,7 +249,7 @@ parse_region (Lisp_Object start, Lisp_Object end,
Lisp_Object base_url,
them. Get the tree the proper way. */
xmlNode *node = xmlDocGetRootElement (doc);
if (node != NULL)
- result = make_dom (node);
+ result = make_dom (node, !NILP(discard_comments));
} else
result = Fcons (Qtop, Fcons (Qnil, Fnreverse (Fcons (r, result))));
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument,
Lars Ingebrigtsen <=
- bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument, Eli Zaretskii, 2018/04/14
- bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument, Lars Ingebrigtsen, 2018/04/14
- bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument, Eli Zaretskii, 2018/04/14
- bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument, Lars Ingebrigtsen, 2018/04/14
- bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument, Eli Zaretskii, 2018/04/14
- bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument, Lars Ingebrigtsen, 2018/04/14
- bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument, Noam Postavsky, 2018/04/14
- bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument, Lars Ingebrigtsen, 2018/04/14
- bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument, Eli Zaretskii, 2018/04/14
- bug#27178: 26.0.50; libxml-parse-*-region functions ignore discard-comments argument, Lars Ingebrigtsen, 2018/04/14