mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
fix: fix zim resource namespace
remove possible namespace from the article,the namespace should follow the following pattern '/J/resoucename.js' etc
This commit is contained in:
parent
aa9ed9bc38
commit
f3975837c4
22
zim.cc
22
zim.cc
|
@ -863,7 +863,7 @@ string ZimDictionary::convert( const string & in )
|
||||||
if( !url.isEmpty() && !url.startsWith( "//" ) && !url.startsWith( "http://" ) && !url.startsWith( "https://" ) )
|
if( !url.isEmpty() && !url.startsWith( "//" ) && !url.startsWith( "http://" ) && !url.startsWith( "https://" ) )
|
||||||
{
|
{
|
||||||
//<\\1 \\2src=\\3bres://%1/
|
//<\\1 \\2src=\\3bres://%1/
|
||||||
url.replace( RX::Zim::linkSpecialChar, "" );
|
url.remove(QRegularExpression("^\\.*\\/[A-Z]\\/", QRegularExpression::CaseInsensitiveOption));
|
||||||
replacedLink =
|
replacedLink =
|
||||||
QString( "<%1 %2 src=\"bres://%3/%4\"" ).arg( list[ 1 ], list[ 2 ], QString::fromStdString( getId() ), url );
|
QString( "<%1 %2 src=\"bres://%3/%4\"" ).arg( list[ 1 ], list[ 2 ], QString::fromStdString( getId() ), url );
|
||||||
}
|
}
|
||||||
|
@ -1520,8 +1520,8 @@ void ZimResourceRequest::run()
|
||||||
|
|
||||||
sptr< Dictionary::DataRequest > ZimDictionary::getResource( string const & name )
|
sptr< Dictionary::DataRequest > ZimDictionary::getResource( string const & name )
|
||||||
{
|
{
|
||||||
auto formatedName = QString::fromStdString(name).replace(RX::Zim::linkSpecialChar,"");
|
// auto formatedName = QString::fromStdString(name).replace(RX::Zim::linkSpecialChar,"");
|
||||||
return new ZimResourceRequest( *this, formatedName.toStdString() );
|
return new ZimResourceRequest( *this, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
//} // anonymous namespace
|
//} // anonymous namespace
|
||||||
|
@ -1693,10 +1693,10 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
url.insert( url.begin(), '/' );
|
// url.insert( url.begin(), '/' );
|
||||||
url.insert( url.begin(), nameSpace );
|
// url.insert( url.begin(), nameSpace );
|
||||||
auto formatedUrl = QString::fromStdString(url).replace(RX::Zim::linkSpecialChar,"");
|
// auto formatedUrl = QString::fromStdString(url).replace(RX::Zim::linkSpecialChar," ");
|
||||||
indexedResources.addSingleWord( Utf8::decode( formatedUrl.toStdString() ), n );
|
indexedResources.addSingleWord( Utf8::decode( url ), n );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1726,16 +1726,14 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( nameSpace == 'X' )
|
if( nameSpace == 'X' || nameSpace=='V' || nameSpace=='U'|| nameSpace=='W' )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
url.insert( url.begin(), '/' );
|
// auto formatedUrl = QString::fromStdString(url).replace(RX::Zim::linkSpecialChar," ");
|
||||||
url.insert( url.begin(), nameSpace );
|
indexedResources.addSingleWord( Utf8::decode( url ), n );
|
||||||
auto formatedUrl = QString::fromStdString(url).replace(RX::Zim::linkSpecialChar,"");
|
|
||||||
indexedResources.addSingleWord( Utf8::decode( formatedUrl.toStdString() ), n );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue