mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
Fix whitespace when serializing empty HTML documents
The old, non-recursive HTML serialization code would always terminate the output with a newline. The new implementation omitted the newline if the document node had no children. Readd the newline when serializing empty documents. Fixes #266.
This commit is contained in:
14
HTMLtree.c
14
HTMLtree.c
@@ -763,11 +763,15 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
|||||||
if (((xmlDocPtr) cur)->intSubset != NULL) {
|
if (((xmlDocPtr) cur)->intSubset != NULL) {
|
||||||
htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL);
|
htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL);
|
||||||
}
|
}
|
||||||
/* Always validate cur->parent when descending. */
|
if (cur->children != NULL) {
|
||||||
if ((cur->parent == parent) && (cur->children != NULL)) {
|
/* Always validate cur->parent when descending. */
|
||||||
parent = cur;
|
if (cur->parent == parent) {
|
||||||
cur = cur->children;
|
parent = cur;
|
||||||
continue;
|
cur = cur->children;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xmlOutputBufferWriteString(buf, "\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user