}
}
- hc->traverse_tags([](const html_tag *tag) -> bool {
+ hc->traverse_block_tags([](const html_tag *tag) -> bool {
/* Summarize content length from children */
for (const auto *cld_tag : tag->children) {
tag->content_length += cld_tag->content_length;
PRE_ORDER,
POST_ORDER
};
- auto traverse_tags(fu2::function<bool(const html_tag *)> &&func,
+ auto traverse_block_tags(fu2::function<bool(const html_tag *)> &&func,
traverse_type how = traverse_type::PRE_ORDER) const -> bool {
if (root_tag == nullptr) {
}
}
+ auto traverse_all_tags(fu2::function<bool(const html_tag *)> &&func) const -> bool {
+ for (const auto &tag : all_tags) {
+ if (!(tag->flags & (FL_CLOSING|FL_XML))) {
+ if (!func(tag.get())) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
private:
~html_content() = default;
};
}
if (hc && (any || !tags.empty()) && lua_isfunction (L, 3)) {
- hc->traverse_tags([&](const rspamd::html::html_tag *tag) -> bool {
+ hc->traverse_all_tags([&](const rspamd::html::html_tag *tag) -> bool {
if (tag && (any || tags.contains(tag->id))) {
lua_pushvalue(L, 3);