fix: treat unknown dsl tags as text

This commit is contained in:
YiFang Xiao 2023-07-14 21:47:15 +08:00 committed by xiaoyifang
parent 7037694ebc
commit 119a5ccb6c
2 changed files with 5 additions and 22 deletions

View file

@ -656,18 +656,12 @@ void ArticleDom::closeTag( wstring const & name,
if ( n != stack.rend() )
{
// If there is a corresponding tag, close all tags above it,
// then close the tag itself, then reopen all the tags which got
// closed.
list< Node > nodesToReopen;
// then close the tag itself
while ( !stack.empty() ) {
bool found = stack.back()->tagName == name ||
checkM( stack.back()->tagName, name );
if ( !found )
nodesToReopen.emplace_back( Node::Tag(), stack.back()->tagName, stack.back()->tagAttrs );
if( stack.back()->empty() && stack.back()->tagName != U"br" )
{
// Empty nodes except [br] tag are deleted since they're no use
@ -684,21 +678,6 @@ void ArticleDom::closeTag( wstring const & name,
if ( found )
break;
}
while ( !nodesToReopen.empty() ) {
if ( stack.empty() )
{
root.push_back( nodesToReopen.back() );
stack.push_back( &root.back() );
}
else
{
stack.back()->push_back( nodesToReopen.back() );
stack.push_back( &stack.back()->back() );
}
nodesToReopen.pop_back();
}
}
else
if ( warn )

View file

@ -531,6 +531,10 @@ div.xdxf
color: gray;
}
.dsl_unknown{
border-bottom: 3px double red;
}
/* Style for expand optional parts button */
.hidden_expand_opt
{