diff --git a/gls.cc b/gls.cc index 42605de9..1c4c758f 100644 --- a/gls.cc +++ b/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( "]*)href=['\"]([^'\"]+)['\"]" ); + QRegExp linksReg( "]*)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; diff --git a/stardict.cc b/stardict.cc index b1b223a0..1235ffda 100644 --- a/stardict.cc +++ b/stardict.cc @@ -341,9 +341,9 @@ string StardictDictionary::handleResource( char type, char const * resource, siz { QString articleText = QString( "
" ) + QString::fromUtf8( resource, size ) + "
"; - 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