mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
1
This commit is contained in:
parent
bb7d517271
commit
fc740bb9d7
|
@ -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>";
|
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::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 );
|
QRegularExpression::CaseInsensitiveOption );
|
||||||
|
|
||||||
articleText.replace( imgRe, "\\1bres://" + QString::fromStdString( getId() ) + "/" )
|
articleText.replace( imgRe, "\\1bres://" + QString::fromStdString( getId() ) + "/" )
|
||||||
|
@ -458,7 +458,7 @@ string StardictDictionary::handleResource( char type, char const * resource, siz
|
||||||
|
|
||||||
// Handle links to articles
|
// 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 );
|
QRegularExpression::CaseInsensitiveOption );
|
||||||
|
|
||||||
|
|
||||||
|
@ -545,8 +545,6 @@ string StardictDictionary::handleResource( char type, char const * resource, siz
|
||||||
articleNewText.clear();
|
articleNewText.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug().noquote() << "StardictDictionary::handleResource: "<<type<<"|"<<resource<<"|" << articleText;
|
|
||||||
|
|
||||||
return articleText.toStdString();
|
return articleText.toStdString();
|
||||||
}
|
}
|
||||||
case 'm': // Pure meaning, usually means preformatted text
|
case 'm': // Pure meaning, usually means preformatted text
|
||||||
|
|
Loading…
Reference in a new issue