mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
MediaWiki: remove the obsolete "fix audio" replacement
I have searched for the "<button" string and even for the "<\s*button" pattern in tens of articles from all 5 default Wikipedia and all 5 default Wiktionary sites. Found none. I assume this pattern is obsolete. Removing this useless code improves performance by doing less searching. I have run the following command on directories that contained many Wikipedia and Wiktionary articles received by GoldenDict: pcregrep -MrI --buffer-size 20M '<\s*button' DIR-WITH-ARTICLES
This commit is contained in:
parent
dec59439b9
commit
261e45a5d7
|
@ -495,14 +495,6 @@ void MediaWikiArticleRequest::requestFinished( QNetworkReply * r )
|
||||||
// Remove the /wiki/ prefix from links
|
// Remove the /wiki/ prefix from links
|
||||||
articleString.replace( "<a href=\"/wiki/", "<a href=\"" );
|
articleString.replace( "<a href=\"/wiki/", "<a href=\"" );
|
||||||
|
|
||||||
//fix audio
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
|
||||||
articleString.replace( QRegularExpression( "<button\\s+[^>]*(upload\\.wikimedia\\.org/wikipedia/commons/[^\"'&]*\\.ogg)[^>]*>\\s*<[^<]*</button>" ),
|
|
||||||
#else
|
|
||||||
articleString.replace( QRegExp( "<button\\s+[^>]*(upload\\.wikimedia\\.org/wikipedia/commons/[^\"'&]*\\.ogg)[^>]*>\\s*<[^<]*</button>"),
|
|
||||||
#endif
|
|
||||||
QString::fromStdString(addAudioLink( string( "\"" ) + wikiUrl.scheme().toStdString() + "://\\1\"", this->dictPtr->getId() ) +
|
|
||||||
"<a href=\"" + wikiUrl.scheme().toStdString() + "://\\1\"><img src=\"qrcx://localhost/icons/playsound.png\" border=\"0\" alt=\"Play\"></a>" ) );
|
|
||||||
// In those strings, change any underscores to spaces
|
// In those strings, change any underscores to spaces
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
||||||
QRegularExpression rxLink( "<a\\s+href=\"[^/:\">#]+" );
|
QRegularExpression rxLink( "<a\\s+href=\"[^/:\">#]+" );
|
||||||
|
|
Loading…
Reference in a new issue