hc:foreach_tag({'font', 'span', 'div', 'p'}, function(tag, len)
local bl = tag:get_extra()
if bl then
- if bl['bgcolor'] and bl['color'] then
+ if bl['bgcolor'] and bl['color'] and bl['visible'] then
local color = bl['color']
local bgcolor = bl['bgcolor']
rspamd_html_process_color (c, p - c, &bl->background_color);
msg_debug_html ("got bgcolor: %xd", bl->background_color.d.val);
}
+ else if (klen == 7 && g_ascii_strncasecmp (key, "display", 7) == 0) {
+ if (p - c >= 4 && rspamd_substring_search_caseless (c, p - c,
+ "none", 4) != -1) {
+ bl->visible = FALSE;
+ msg_debug_html ("tag is not visible");
+ }
+ }
}
key = NULL;
cur = tag->params->head;
bl = rspamd_mempool_alloc0 (pool, sizeof (*bl));
bl->tag = tag;
+ bl->visible = TRUE;
while (cur) {
comp = cur->data;
}
else if (!(cur_tag->flags & FL_CLOSING) &&
(cur_tag->flags & FL_BLOCK)) {
+ struct html_block *bl;
+
rspamd_html_process_block_tag (pool, cur_tag, hc);
+ bl = cur_tag->extra;
+
+ if (bl && !bl->visible) {
+ state = content_ignore;
+ }
}
}
else {
struct html_color background_color;
struct html_tag_component style;
guint font_size;
+ gboolean visible;
gchar *class;
};
struct rspamd_lua_text *t;
struct html_tag **ptag;
- lua_createtable (L, 0, 4);
+ lua_createtable (L, 0, 5);
if (bl->tag) {
lua_pushstring (L, "tag");
t->flags = 0;
lua_settable (L, -3);
}
+
+ lua_pushstring (L, "visible");
+ lua_pushboolean (L, bl->visible);
+ lua_settable (L, -3);
}
static gint