MDict: One more fix for script handling

This commit is contained in:
Abs62 2016-03-28 18:52:16 +03:00
parent 5ac287190d
commit 2221beb249

6
mdx.cc
View file

@ -998,15 +998,15 @@ QString & MdxDictionary::filterResource( QString const & articleId, QString & ar
// javascripts // javascripts
QRegExp regScript( "(<\\s*script\\s+[^>]*\\bsrc\\b\\s*=\\s*[\"']+)(?:file://)?[\\x00-\\x30\\x7f]*([^\"']*)", QRegExp regScript( "(<\\s*script\\s+[^>]*\\bsrc\\b\\s*=\\s*[\"']+)(?:file://)?[\\x00-\\x30\\x7f]*([^\"']*)",
Qt::CaseInsensitive, QRegExp::RegExp2 ); Qt::CaseInsensitive, QRegExp::RegExp2 );
QRegExp regDynamic( "\\Wreplace(" ); QRegExp regDynamic( "<\\s*script\\s+src\\s*=\\s*[\"']+\\s*[\"']+\\s*\\+\\s*replace\\(" );
pos = 0; pos = 0;
while( pos >= 0 ) while( pos >= 0 )
{ {
pos = wordCrossLink.indexIn( article, pos ); pos = regScript.indexIn( article, pos );
if( pos < 0 ) if( pos < 0 )
break; break;
if( regScript.cap( 1 ).indexOf( regDynamic ) >= 0 ) if( regScript.cap( 0 ).indexOf( regDynamic ) >= 0 )
{ {
pos += regScript.cap( 0 ).size(); pos += regScript.cap( 0 ).size();
continue; continue;