mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-18 03:14:06 +00:00
Fix display of abbreviations contained '-' character
This commit is contained in:
parent
72a8a09513
commit
010b4dc974
9
dsl.cc
9
dsl.cc
|
@ -1022,15 +1022,24 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
|
||||||
title.reserve( i->second.size() );
|
title.reserve( i->second.size() );
|
||||||
|
|
||||||
for( char const * c = i->second.c_str(); *c; ++c )
|
for( char const * c = i->second.c_str(); *c; ++c )
|
||||||
|
{
|
||||||
if ( *c == ' ' || *c == '\t' )
|
if ( *c == ' ' || *c == '\t' )
|
||||||
{
|
{
|
||||||
// u00A0 in utf8
|
// u00A0 in utf8
|
||||||
title.push_back( 0xC2 );
|
title.push_back( 0xC2 );
|
||||||
title.push_back( 0xA0 );
|
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
|
else
|
||||||
title.push_back( *c );
|
title.push_back( *c );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
title = i->second;
|
title = i->second;
|
||||||
|
|
||||||
|
|
|
@ -348,15 +348,24 @@ string convert( string const & in, DICT_TYPE type, map < string, string > const
|
||||||
title.reserve( i->second.size() );
|
title.reserve( i->second.size() );
|
||||||
|
|
||||||
for( char const * c = i->second.c_str(); *c; ++c )
|
for( char const * c = i->second.c_str(); *c; ++c )
|
||||||
|
{
|
||||||
if ( *c == ' ' || *c == '\t' )
|
if ( *c == ' ' || *c == '\t' )
|
||||||
{
|
{
|
||||||
// u00A0 in utf8
|
// u00A0 in utf8
|
||||||
title.push_back( 0xC2 );
|
title.push_back( 0xC2 );
|
||||||
title.push_back( 0xA0 );
|
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
|
else
|
||||||
title.push_back( *c );
|
title.push_back( *c );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
title = i->second;
|
title = i->second;
|
||||||
el.setAttribute( "title", gd::toQString( Utf8::decode( title ) ) );
|
el.setAttribute( "title", gd::toQString( Utf8::decode( title ) ) );
|
||||||
|
|
Loading…
Reference in a new issue