Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Jul 20, 2024
1 parent bb7d517 commit fc740bb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/dict/stardict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -448,17 +448,17 @@ 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() ) + "/" )
.replace( linkRe, "\\1bres://" + QString::fromStdString( getId() ) + "/" );

// 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 );


Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fc740bb

Please sign in to comment.