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,14 +1022,23 @@ 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;

View file

@ -348,14 +348,23 @@ 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;