mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
GLS, Stardict: Fix some links handling
This commit is contained in:
parent
ffd56c73dc
commit
94583da9a3
9
gls.cc
9
gls.cc
|
@ -819,7 +819,7 @@ QString & GlsDictionary::filterResource( QString & article )
|
|||
|
||||
// Handle links to articles
|
||||
|
||||
QRegExp linksReg( "<a(\\s*[^>]*)href\\s*=\\s*['\"](?:bword://)?([^'\"]+)['\"]" );
|
||||
QRegExp linksReg( "<a(\\s*[^>]*)href\\s*=\\s*['\"](bword://)?([^'\"]+)['\"]" );
|
||||
linksReg.setMinimal( true );
|
||||
|
||||
int pos = 0;
|
||||
|
@ -829,7 +829,7 @@ QString & GlsDictionary::filterResource( QString & article )
|
|||
if( pos < 0 )
|
||||
break;
|
||||
|
||||
QString link = linksReg.cap( 2 );
|
||||
QString link = linksReg.cap( 3 );
|
||||
if( link.indexOf( ':' ) < 0 )
|
||||
{
|
||||
QString newLink;
|
||||
|
@ -1148,11 +1148,6 @@ void GlsArticleRequest::run()
|
|||
result += i->second.second;
|
||||
}
|
||||
|
||||
result = QString::fromUtf8( result.c_str() )
|
||||
.replace( QRegExp( "(<\\s*a\\s+[^>]*href\\s*=\\s*[\"']\\s*)bword://", Qt::CaseInsensitive ),
|
||||
"\\1bword:" )
|
||||
.toUtf8().data();
|
||||
|
||||
Mutex::Lock _( dataMutex );
|
||||
|
||||
data.resize( result.size() );
|
||||
|
|
|
@ -351,7 +351,7 @@ string StardictDictionary::handleResource( char type, char const * resource, siz
|
|||
|
||||
// Handle links to articles
|
||||
|
||||
QRegExp linksReg( "<a(\\s*[^>]*)href\\s*=\\s*['\"](?:bword://)?([^'\"]+)['\"]" );
|
||||
QRegExp linksReg( "<a(\\s*[^>]*)href\\s*=\\s*['\"](bword://)?([^'\"]+)['\"]" );
|
||||
linksReg.setMinimal( true );
|
||||
|
||||
int pos = 0;
|
||||
|
@ -361,7 +361,7 @@ string StardictDictionary::handleResource( char type, char const * resource, siz
|
|||
if( pos < 0 )
|
||||
break;
|
||||
|
||||
QString link = linksReg.cap( 2 );
|
||||
QString link = linksReg.cap( 3 );
|
||||
if( link.indexOf( ':' ) < 0 )
|
||||
{
|
||||
QString newLink;
|
||||
|
|
Loading…
Reference in a new issue