(element.attributes.data[i]);
if(strcmp(attrib->name, attrib_name) == 0)
return attrib->value;
}
return nullptr;
}
static void renderRecursive(RenderState & state, GumboNode const & node, int nesting = 0)
{
auto & stream = state.stream;
auto & outline = state.outline;
switch(node.type)
{
/** Document node. v will be a GumboDocument. */
case GUMBO_NODE_DOCUMENT: {
qWarning() << "Detected embedded document";
break;
}
/** Element node.v will be a GumboElement. */
case GUMBO_NODE_ELEMENT: {
auto const & element = node.v.element;
// qDebug() << "begin node(" << gumbo_normalized_tagname(element.tag) << ")";
bool process_header = false;
QString header_text;
// Fetch the original `id` attribute if any
char const * const header_id = getAttribute(element, "id");
QString const anchor = (header_id != nullptr) ? QString(header_id) : QString("header-%1").arg(state.header_count);
switch(element.tag) {
// Stripped tags
case GUMBO_TAG_STYLE:
case GUMBO_TAG_SCRIPT:
case GUMBO_TAG_UNKNOWN:
return;
case GUMBO_TAG_BR:
stream += "
";
return;
case GUMBO_TAG_HR:
// This is not nice, but better than the original
tag.
// This will have the primary font color instead of *some* color.
stream += "" + QString(" ").repeated(50) + "
";
return;
case GUMBO_TAG_NAV: {
if(kristall::globals().options.strip_nav)
return;
stream += "