Fix display of abbreviations contained '-' character

This commit is contained in:
Abs62 2016-08-03 17:29:15 +03:00
parent 72a8a09513
commit 010b4dc974
2 changed files with 18 additions and 0 deletions

9
dsl.cc
View file

@ -1022,15 +1022,24 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
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;

View file

@ -348,15 +348,24 @@ string convert( string const & in, DICT_TYPE type, map < string, string > const
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;
el.setAttribute( "title", gd::toQString( Utf8::decode( title ) ) );