diff --git a/src/html/htmlparser.cpp b/src/html/htmlparser.cpp
index 9b61b1d..21a826f 100644
--- a/src/html/htmlparser.cpp
+++ b/src/html/htmlparser.cpp
@@ -1126,7 +1126,7 @@ return true;
void HTMLParser::PutClosingTag(const Item & item)
{
- if( skip_tags || !IsTagSafe(item.name) )
+ if( skip_tags || !IsTagSafe(item.name) || IsNameEqual(no_filter_tag, LastItem().name) )
return;
if( item.is_commentary )
@@ -1945,17 +1945,22 @@ void HTMLParser::CheckClosingTags()
{
CheckWhiteCharsExceptions(pstack[z]);
- if( !skip_tags && pstack[z].new_line )
+ if( !skip_tags && IsTagSafe(LastItem().name) && !IsNameEqual(no_filter_tag, LastItem().name) )
{
- if( current_white_char_mode() == WHITE_MODE_TREE )
+ if( pstack[z].new_line )
{
- Put(10);
- PutTabs(pstack[z].tree_index);
+ if( current_white_char_mode() == WHITE_MODE_TREE )
+ {
+ Put(10);
+ PutTabs(pstack[z].tree_index);
+ }
}
- }
- PutClosingTag(pstack[z]);
- pstack[z].Clear();
+ // IMPROVEME
+ // in PutClosingTag we test IsTagSafe() and no_filter_tag too
+ PutClosingTag(pstack[z]);
+ pstack[z].Clear();
+ }
}
// invalidate items on the stack