if (hc->all_tags.empty()) {
auto &&vtag = std::make_unique<html_tag>();
- vtag->id = tag->id;
- vtag->flags = FL_VIRTUAL|FL_CLOSED;
+ vtag->id = Tag_HTML;
+ vtag->flags = FL_VIRTUAL;
vtag->tag_start = 0;
vtag->content_offset = 0;
calculate_content_length(vtag.get());
else {
vtag->parent = hc->root_tag;
}
+
hc->all_tags.emplace_back(std::move(vtag));
+ tag->parent = vtag.get();
- return vtag.get();
+ /* Recursively call with a virtual <html> tag inserted */
+ return html_check_balance(hc, tag, tag_start_offset, tag_end_offset);
}
}
{
const std::vector<std::pair<std::string, std::string>> cases{
+ {"</head>\n"
+ "<body>\n"
+ "<p> Hello. I have some bad news.\n"
+ "<br /> <br /> <br /> <strong> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> </strong><span> <br /> </span></p>\n"
+ "</body>\n"
+ "</html>", " Hello. I have some bad news.\n\n\n\n\n\n\n\n"},
{" <body>\n"
" <!-- escape content -->\n"
" a b a > b a < b a & b 'a "a"\n"