mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
+! Only make dsl tooltip nonbreakable if its length is less than 70 symbols
long.
This commit is contained in:
parent
dfb067b370
commit
2a92cb697d
26
src/dsl.cc
26
src/dsl.cc
|
@ -695,17 +695,23 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
|
||||||
// Replace all spaces with non-breakable ones, since that's how
|
// Replace all spaces with non-breakable ones, since that's how
|
||||||
// Lingvo shows tooltips
|
// Lingvo shows tooltips
|
||||||
string title;
|
string title;
|
||||||
title.reserve( i->second.size() );
|
|
||||||
|
|
||||||
for( char const * c = i->second.c_str(); *c; ++c )
|
if ( Utf8::decode( i->second ).size() < 70 )
|
||||||
if ( *c == ' ' || *c == '\t' )
|
{
|
||||||
{
|
title.reserve( i->second.size() );
|
||||||
// u00A0 in utf8
|
|
||||||
title.push_back( 0xC2 );
|
for( char const * c = i->second.c_str(); *c; ++c )
|
||||||
title.push_back( 0xA0 );
|
if ( *c == ' ' || *c == '\t' )
|
||||||
}
|
{
|
||||||
else
|
// u00A0 in utf8
|
||||||
title.push_back( *c );
|
title.push_back( 0xC2 );
|
||||||
|
title.push_back( 0xA0 );
|
||||||
|
}
|
||||||
|
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