mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
zim img src link replace regex changes
This commit is contained in:
parent
f730a4aabc
commit
9f6ed1eec2
8
zim.cc
8
zim.cc
|
@ -838,7 +838,7 @@ string ZimDictionary::convert( const string & in )
|
||||||
QString( "<body \\1" ) );
|
QString( "<body \\1" ) );
|
||||||
|
|
||||||
// pattern of img and script
|
// pattern of img and script
|
||||||
text.replace( QRegularExpression( "<\\s*(img|script)\\s+([^>]*)src=(\"|)(\\.\\.|)/" ),
|
text.replace( QRegularExpression( "<\\s*(img|script)\\s+([^>]*)src=(\"|)(\\.\\./)*" ),
|
||||||
QString( "<\\1 \\2src=\\3bres://%1/").arg( getId().c_str() ) );
|
QString( "<\\1 \\2src=\\3bres://%1/").arg( getId().c_str() ) );
|
||||||
|
|
||||||
// Fix links without '"'
|
// Fix links without '"'
|
||||||
|
@ -1488,9 +1488,9 @@ void ZimResourceRequest::run()
|
||||||
}
|
}
|
||||||
|
|
||||||
sptr< Dictionary::DataRequest > ZimDictionary::getResource( string const & name )
|
sptr< Dictionary::DataRequest > ZimDictionary::getResource( string const & name )
|
||||||
|
|
||||||
{
|
{
|
||||||
return new ZimResourceRequest( *this, name );
|
auto formatedName = QString::fromStdString(name).replace(QRegularExpression("[\\.\\/]"),"");
|
||||||
|
return new ZimResourceRequest( *this, formatedName.toStdString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//} // anonymous namespace
|
//} // anonymous namespace
|
||||||
|
@ -1662,8 +1662,6 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// url.insert( url.begin(), '/' );
|
|
||||||
// url.insert( url.begin(), nameSpace );
|
|
||||||
auto formatedUrl = QString::fromStdString(url).replace(QRegularExpression("[\\.\\/]"),"");
|
auto formatedUrl = QString::fromStdString(url).replace(QRegularExpression("[\\.\\/]"),"");
|
||||||
indexedResources.addSingleWord( Utf8::decode( formatedUrl.toStdString() ), n );
|
indexedResources.addSingleWord( Utf8::decode( formatedUrl.toStdString() ), n );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue