This commit is contained in:
Xiao Yi Fang 2024-07-20 09:34:22 +08:00
parent bb7d517271
commit fc740bb9d7

View file

@ -448,9 +448,9 @@ string StardictDictionary::handleResource( char type, char const * resource, siz
{
QString articleText = QString( "<div class=\"sdct_h\">" ) + QString::fromUtf8( resource, size ) + "</div>";
QRegularExpression imgRe( R"((<\s*(?:img|script)\s+[^>]*src\s*=\s*["']?)(?!(?:data|https?|ftp):))",
static QRegularExpression imgRe( R"((<\s*(?:img|script)\s+[^>]*src\s*=\s*["']?)(?!(?:data|https?|ftp):))",
QRegularExpression::CaseInsensitiveOption );
QRegularExpression linkRe( R"((<\s*link\s+[^>]*href\s*=\s*["']?)(?!(?:data|https?|ftp):))",
static QRegularExpression linkRe( R"((<\s*link\s+[^>]*href\s*=\s*["']?)(?!(?:data|https?|ftp):))",
QRegularExpression::CaseInsensitiveOption );
articleText.replace( imgRe, "\\1bres://" + QString::fromStdString( getId() ) + "/" )
@ -458,7 +458,7 @@ string StardictDictionary::handleResource( char type, char const * resource, siz
// Handle links to articles
QRegularExpression linksReg( R"(<a(\s*[^>]*)href\s*=\s*['"](bword://)?([^'"]+)['"])",
static QRegularExpression linksReg( R"(<a(\s*[^>]*)href\s*=\s*['"](bword://)?([^'"]+)['"])",
QRegularExpression::CaseInsensitiveOption );
@ -545,8 +545,6 @@ string StardictDictionary::handleResource( char type, char const * resource, siz
articleNewText.clear();
}
qDebug().noquote() << "StardictDictionary::handleResource: "<<type<<"|"<<resource<<"|" << articleText;
return articleText.toStdString();
}
case 'm': // Pure meaning, usually means preformatted text