mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
GLS, Stardict: Fix some links handling
This commit is contained in:
parent
1d90cd5c76
commit
5b80f75637
8
gls.cc
8
gls.cc
|
@ -796,14 +796,14 @@ void GlsDictionary::loadArticle( uint32_t address,
|
|||
|
||||
QString & GlsDictionary::filterResource( QString & article )
|
||||
{
|
||||
article.replace( QRegExp( "(<\\s*img\\s+[^>]*src\\s*=\\s*[\"']+)((?!data:)[^\"']*)", Qt::CaseInsensitive ),
|
||||
article.replace( QRegExp( "(<\\s*img\\s+[^>]*src\\s*=\\s*[\"']+)((?!(data|https?|ftp):)[^\"']*)", Qt::CaseInsensitive ),
|
||||
"\\1bres://" + QString::fromStdString( getId() ) + "/\\2" )
|
||||
.replace( QRegExp( "(<\\s*link\\s+[^>]*href\\s*=\\s*[\"']+)((?!data:)[^\"']*)", Qt::CaseInsensitive ),
|
||||
.replace( QRegExp( "(<\\s*link\\s+[^>]*href\\s*=\\s*[\"']+)((?!(data|https?|ftp):)[^\"']*)", Qt::CaseInsensitive ),
|
||||
"\\1bres://" + QString::fromStdString( getId() ) + "/\\2" );
|
||||
|
||||
// Handle links to articles
|
||||
|
||||
QRegExp linksReg( "<a(\\s*[^>]*)href=['\"]([^'\"]+)['\"]" );
|
||||
QRegExp linksReg( "<a(\\s*[^>]*)href=['\"](bword://)?([^'\"]+)['\"]" );
|
||||
|
||||
int pos = 0;
|
||||
while( pos >= 0 )
|
||||
|
@ -812,7 +812,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;
|
||||
|
|
|
@ -341,9 +341,9 @@ string StardictDictionary::handleResource( char type, char const * resource, siz
|
|||
{
|
||||
QString articleText = QString( "<div class=\"sdct_h\">" ) + QString::fromUtf8( resource, size ) + "</div>";
|
||||
|
||||
articleText.replace( QRegExp( "(<\\s*img\\s+[^>]*src\\s*=\\s*[\"']+)((?!data:)[^\"']*)", Qt::CaseInsensitive ),
|
||||
articleText.replace( QRegExp( "(<\\s*img\\s+[^>]*src\\s*=\\s*[\"']+)((?!(data|https?|ftp):)[^\"']*)", Qt::CaseInsensitive ),
|
||||
"\\1bres://" + QString::fromStdString( getId() ) + "/\\2" )
|
||||
.replace( QRegExp( "(<\\s*link\\s+[^>]*href\\s*=\\s*[\"']+)((?!data:)[^\"']*)", Qt::CaseInsensitive ),
|
||||
.replace( QRegExp( "(<\\s*link\\s+[^>]*href\\s*=\\s*[\"']+)((?!(data|https?|ftp):)[^\"']*)", Qt::CaseInsensitive ),
|
||||
"\\1bres://" + QString::fromStdString( getId() ) + "/\\2" );
|
||||
|
||||
// Handle links to articles
|
||||
|
|
Loading…
Reference in a new issue