Differential D12096 Diff 29373 files/0004-Fix-whitespace-when-serializing-empty-HTML-documents.patch
Changeset View
Changeset View
Standalone View
Standalone View
files/0004-Fix-whitespace-when-serializing-empty-HTML-documents.patch
- This file was added.
| From 92d9ab4c28842a09ca2b76d3ff2f933e01b6cd6f Mon Sep 17 00:00:00 2001 | |||||
| From: Nick Wellnhofer <wellnhofer@aevum.de> | |||||
| Date: Mon, 7 Jun 2021 15:09:53 +0200 | |||||
| Subject: [PATCH] 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. | |||||
| --- | |||||
| HTMLtree.c | 14 +++++++++----- | |||||
| 1 file changed, 9 insertions(+), 5 deletions(-) | |||||
| diff --git a/HTMLtree.c b/HTMLtree.c | |||||
| index bdd639c7..7a2b8558 100644 | |||||
| --- a/HTMLtree.c | |||||
| +++ b/HTMLtree.c | |||||
| @@ -763,11 +763,15 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, | |||||
| if (((xmlDocPtr) cur)->intSubset != NULL) { | |||||
| htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL); | |||||
| } | |||||
| - /* Always validate cur->parent when descending. */ | |||||
| - if ((cur->parent == parent) && (cur->children != NULL)) { | |||||
| - parent = cur; | |||||
| - cur = cur->children; | |||||
| - continue; | |||||
| + if (cur->children != NULL) { | |||||
| + /* Always validate cur->parent when descending. */ | |||||
| + if (cur->parent == parent) { | |||||
| + parent = cur; | |||||
| + cur = cur->children; | |||||
| + continue; | |||||
| + } | |||||
| + } else { | |||||
| + xmlOutputBufferWriteString(buf, "\n"); | |||||
| } | |||||
| break; | |||||
| -- | |||||
| GitLab | |||||
Copyright © 2015-2021 Solus Project. The Solus logo is Copyright © 2016-2021 Solus Project. All Rights Reserved.