[Tablegen] Add function to generate the table as node child

This commit is contained in:
TennesseeTrash 2025-06-14 20:33:49 +02:00
parent 9fad3c41b2
commit e787b94ae1
2 changed files with 11 additions and 5 deletions

View file

@ -115,15 +115,14 @@ namespace Tablegen
doc.save_file("test.html", " ", formatOptions);
}
pugi::xml_document GenerateDocument(const Settings& settings)
void GenerateAsChild(pugi::xml_node& node, const Settings& settings)
{
pugi::xml_document doc;
pugi::xml_node tableRoot = doc;
pugi::xml_node tableRoot = node;
if (settings.FullDocument == Flag::Enable) {
doc.append_child(pugi::node_doctype).set_value("html");
node.append_child(pugi::node_doctype).set_value("html");
pugi::xml_node html = doc.append_child("html");
pugi::xml_node html = node.append_child("html");
pugi::xml_node head = html.append_child("head");\
head.append_child("title").append_child(pugi::node_pcdata).set_value("Kanji Table");
@ -200,7 +199,12 @@ namespace Tablegen
styles.append_child(pugi::node_pcdata).set_value(Styles(settings, indent, tagIndent,
staticImg, animatedImg));
script.append_child(pugi::node_pcdata).set_value(Script(indent, tagIndent, buttons));
}
pugi::xml_document GenerateDocument(const Settings& settings)
{
pugi::xml_document doc;
GenerateAsChild(doc);
return doc;
}
}