mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:15:11 +00:00
[MOD] Get rid of childrenless tags in XMLd text
This commit is contained in:
parent
3c5b9aac82
commit
74f3fbdccc
3 changed files with 51 additions and 0 deletions
|
|
@ -294,6 +294,7 @@ ShoveXML(XEP393Element *element, XMLElement *xmlparent)
|
|||
{
|
||||
XMLElement *head = xmlparent;
|
||||
size_t i;
|
||||
bool par = false;
|
||||
if (!element || !xmlparent)
|
||||
{
|
||||
return;
|
||||
|
|
@ -324,6 +325,7 @@ ShoveXML(XEP393Element *element, XMLElement *xmlparent)
|
|||
case XEP393_LINE:
|
||||
head = XMLCreateTag("p");
|
||||
XMLAddChild(xmlparent, head);
|
||||
par = true;
|
||||
break;
|
||||
case XEP393_QUOT:
|
||||
head = XMLCreateTag("blockquote");
|
||||
|
|
@ -360,6 +362,17 @@ ShoveXML(XEP393Element *element, XMLElement *xmlparent)
|
|||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
/* NOTE: Hack to get rid of stranded <p/>-tags with no
|
||||
* children. */
|
||||
if (par && ArraySize(head->children) == 0)
|
||||
{
|
||||
ArrayDelete(
|
||||
xmlparent->children,
|
||||
ArraySize(xmlparent->children) - 1
|
||||
);
|
||||
XMLFreeElement(head);
|
||||
}
|
||||
}
|
||||
|
||||
#include <StringStream.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue