fix: qt warning when parsing unknown color attribute

related to goldendict/goldendict#1578
This commit is contained in:
Xiao YiFang 2022-12-11 12:43:48 +08:00
parent d969b63c1e
commit 2263dfc8da
3 changed files with 13 additions and 5 deletions

View file

@ -390,7 +390,7 @@ div.xdxf
display:inline;
}
.dsl_article font[color=c_default_color]
.dsl_article .c_default_color
{
color: green;
}

View file

@ -396,7 +396,7 @@ div.xdxf
display:inline;
}
.dsl_article font[color=c_default_color]
.dsl_article .c_default_color
{
color: green;
}

14
dsl.cc
View file

@ -809,9 +809,17 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
}
else if( node.tagName == U"c" )
{
result += "<font color=\"" + ( node.tagAttrs.size() ?
Html::escape( Utf8::encode( node.tagAttrs ) ) : string( "c_default_color" ) )
+ "\">" + processNodeChildren( node ) + "</font>";
if( node.tagAttrs.empty() )
{
result += "<span class=\"c_default_color\">"
+ processNodeChildren( node ) + "</span>";
}
else
{
result += "<font color=\""
+ Html::escape( Utf8::encode( node.tagAttrs ) ) + "\">"
+ processNodeChildren( node ) + "</font>";
}
}
else if( node.tagName == U"*" )
{