mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
DSL: Don't convert escaped spaces into non-breakable inside [s] tag
This commit is contained in:
parent
72dfe25ff3
commit
7db077bd03
|
@ -174,6 +174,7 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName,
|
||||||
root( Node::Tag(), wstring(), wstring() ), stringPos( str.c_str() ),
|
root( Node::Tag(), wstring(), wstring() ), stringPos( str.c_str() ),
|
||||||
lineStartPos( str.c_str() ),
|
lineStartPos( str.c_str() ),
|
||||||
transcriptionCount( 0 ),
|
transcriptionCount( 0 ),
|
||||||
|
mediaCount( 0 ),
|
||||||
dictionaryName( dictName ),
|
dictionaryName( dictName ),
|
||||||
headword( headword_ )
|
headword( headword_ )
|
||||||
{
|
{
|
||||||
|
@ -355,6 +356,18 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName,
|
||||||
++transcriptionCount;
|
++transcriptionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the tag is [s], we update the mediaCount
|
||||||
|
if ( name == GD_NATIVE_TO_WS( L"s" ) )
|
||||||
|
{
|
||||||
|
if ( isClosing )
|
||||||
|
{
|
||||||
|
if ( mediaCount )
|
||||||
|
--mediaCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
++mediaCount;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !isClosing )
|
if ( !isClosing )
|
||||||
{
|
{
|
||||||
if ( name == GD_NATIVE_TO_WS( L"m" ) ||
|
if ( name == GD_NATIVE_TO_WS( L"m" ) ||
|
||||||
|
@ -598,7 +611,7 @@ ArticleDom::ArticleDom( wstring const & str, string const & dictName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( escaped && ch == L' ' )
|
if ( escaped && ch == L' ' && mediaCount == 0 )
|
||||||
ch = 0xA0; // Escaped spaces turn into non-breakable ones in Lingvo
|
ch = 0xA0; // Escaped spaces turn into non-breakable ones in Lingvo
|
||||||
|
|
||||||
textNode->text.push_back( ch );
|
textNode->text.push_back( ch );
|
||||||
|
|
|
@ -93,6 +93,7 @@ private:
|
||||||
wchar ch;
|
wchar ch;
|
||||||
bool escaped;
|
bool escaped;
|
||||||
unsigned transcriptionCount; // >0 = inside a [t] tag
|
unsigned transcriptionCount; // >0 = inside a [t] tag
|
||||||
|
unsigned mediaCount; // >0 = inside a [s] tag
|
||||||
|
|
||||||
void nextChar() THROW_SPEC( eot );
|
void nextChar() THROW_SPEC( eot );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue