mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
*! Some more fixes for Dsl behaviour.
This commit is contained in:
parent
7e503fcedd
commit
843f1a6bd8
23
src/dsl.cc
23
src/dsl.cc
|
@ -396,6 +396,7 @@ void DslDictionary::loadArticle( uint32_t address,
|
||||||
bool hadFirstHeadword = false;
|
bool hadFirstHeadword = false;
|
||||||
bool foundDisplayedHeadword = false;
|
bool foundDisplayedHeadword = false;
|
||||||
|
|
||||||
|
wstring tildeValueWithUnsorted; // This one has unsorted parts left
|
||||||
for( headwordIndex = 0; ; )
|
for( headwordIndex = 0; ; )
|
||||||
{
|
{
|
||||||
size_t begin = pos;
|
size_t begin = pos;
|
||||||
|
@ -409,26 +410,31 @@ void DslDictionary::loadArticle( uint32_t address,
|
||||||
{
|
{
|
||||||
// Process the headword
|
// Process the headword
|
||||||
|
|
||||||
wstring rawHeadword = Folding::trimWhitespace( wstring( articleData, begin, pos - begin ) );
|
wstring rawHeadword = wstring( articleData, begin, pos - begin );
|
||||||
|
|
||||||
if ( !hadFirstHeadword )
|
if ( !hadFirstHeadword )
|
||||||
{
|
{
|
||||||
// We need our tilde expansion value
|
// We need our tilde expansion value
|
||||||
tildeValue = rawHeadword;
|
tildeValue = rawHeadword;
|
||||||
processUnsortedParts( tildeValue, false );
|
|
||||||
list< wstring > lst;
|
list< wstring > lst;
|
||||||
|
|
||||||
expandOptionalParts( tildeValue, lst );
|
expandOptionalParts( tildeValue, lst );
|
||||||
|
|
||||||
if ( lst.size() ) // Should always be
|
if ( lst.size() ) // Should always be
|
||||||
tildeValue = lst.front();
|
tildeValue = lst.front();
|
||||||
|
|
||||||
|
tildeValueWithUnsorted = tildeValue;
|
||||||
|
|
||||||
|
processUnsortedParts( tildeValue, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring str = rawHeadword;
|
wstring str = rawHeadword;
|
||||||
processUnsortedParts( str, true );
|
|
||||||
|
|
||||||
if ( hadFirstHeadword )
|
if ( hadFirstHeadword )
|
||||||
expandTildes( str, tildeValue );
|
expandTildes( str, tildeValueWithUnsorted );
|
||||||
|
|
||||||
|
processUnsortedParts( str, true );
|
||||||
|
|
||||||
str = Folding::applySimpleCaseOnly( str );
|
str = Folding::applySimpleCaseOnly( str );
|
||||||
|
|
||||||
|
@ -441,13 +447,14 @@ void DslDictionary::loadArticle( uint32_t address,
|
||||||
for( list< wstring >::iterator i = lst.begin(); i != lst.end(); ++i )
|
for( list< wstring >::iterator i = lst.begin(); i != lst.end(); ++i )
|
||||||
{
|
{
|
||||||
unescapeDsl( *i );
|
unescapeDsl( *i );
|
||||||
if ( *i == requestedHeadwordFolded )
|
|
||||||
|
if ( Folding::trimWhitespace( *i ) == requestedHeadwordFolded )
|
||||||
{
|
{
|
||||||
// Found it. Now we should make a displayed headword for it.
|
// Found it. Now we should make a displayed headword for it.
|
||||||
processUnsortedParts( rawHeadword, false );
|
|
||||||
|
|
||||||
if ( hadFirstHeadword )
|
if ( hadFirstHeadword )
|
||||||
expandTildes( rawHeadword, tildeValue );
|
expandTildes( rawHeadword, tildeValueWithUnsorted );
|
||||||
|
|
||||||
|
processUnsortedParts( rawHeadword, false );
|
||||||
|
|
||||||
displayedHeadword = rawHeadword;
|
displayedHeadword = rawHeadword;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue