mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 08:34:08 +00:00
Merge pull request #837 from xiaoyifang/opt/dsl-old-logic
fix: dsl remove too old code logic
This commit is contained in:
commit
8ecf3b6cbc
|
@ -993,39 +993,11 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
|
||||||
|
|
||||||
// If we have such a key, display a title
|
// If we have such a key, display a title
|
||||||
|
|
||||||
map< string, string >::const_iterator i = abrv.find( val );
|
auto i = abrv.find( val );
|
||||||
|
|
||||||
if ( i != abrv.end() )
|
if ( i != abrv.end() )
|
||||||
{
|
{
|
||||||
string title;
|
string title = i->second;
|
||||||
|
|
||||||
if ( Utf8::decode( i->second ).size() < 70 )
|
|
||||||
{
|
|
||||||
// Replace all spaces with non-breakable ones, since that's how
|
|
||||||
// Lingvo shows tooltips
|
|
||||||
title.reserve( i->second.size() );
|
|
||||||
|
|
||||||
for( char const * c = i->second.c_str(); *c; ++c )
|
|
||||||
{
|
|
||||||
if ( *c == ' ' || *c == '\t' )
|
|
||||||
{
|
|
||||||
// u00A0 in utf8
|
|
||||||
title.push_back( 0xC2 );
|
|
||||||
title.push_back( 0xA0 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if( *c == '-' ) // Change minus to non-breaking hyphen (uE28091 in utf8)
|
|
||||||
{
|
|
||||||
title.push_back( 0xE2 );
|
|
||||||
title.push_back( 0x80 );
|
|
||||||
title.push_back( 0x91 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
title.push_back( *c );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
title = i->second;
|
|
||||||
|
|
||||||
result += " title=\"" + Html::escape( title ) + "\"";
|
result += " title=\"" + Html::escape( title ) + "\"";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue