mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
fix: treat unknown dsl tags as text
This commit is contained in:
parent
7037694ebc
commit
119a5ccb6c
|
@ -656,18 +656,12 @@ void ArticleDom::closeTag( wstring const & name,
|
||||||
if ( n != stack.rend() )
|
if ( n != stack.rend() )
|
||||||
{
|
{
|
||||||
// If there is a corresponding tag, close all tags above it,
|
// If there is a corresponding tag, close all tags above it,
|
||||||
// then close the tag itself, then reopen all the tags which got
|
// then close the tag itself
|
||||||
// closed.
|
|
||||||
|
|
||||||
list< Node > nodesToReopen;
|
|
||||||
|
|
||||||
while ( !stack.empty() ) {
|
while ( !stack.empty() ) {
|
||||||
bool found = stack.back()->tagName == name ||
|
bool found = stack.back()->tagName == name ||
|
||||||
checkM( 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" )
|
if( stack.back()->empty() && stack.back()->tagName != U"br" )
|
||||||
{
|
{
|
||||||
// Empty nodes except [br] tag are deleted since they're no use
|
// Empty nodes except [br] tag are deleted since they're no use
|
||||||
|
@ -684,21 +678,6 @@ void ArticleDom::closeTag( wstring const & name,
|
||||||
if ( found )
|
if ( found )
|
||||||
break;
|
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
|
else
|
||||||
if ( warn )
|
if ( warn )
|
||||||
|
|
|
@ -531,6 +531,10 @@ div.xdxf
|
||||||
color: gray;
|
color: gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dsl_unknown{
|
||||||
|
border-bottom: 3px double red;
|
||||||
|
}
|
||||||
|
|
||||||
/* Style for expand optional parts button */
|
/* Style for expand optional parts button */
|
||||||
.hidden_expand_opt
|
.hidden_expand_opt
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue