*! Process article links in wikis hosted on non-root locations correctly.

This actually makes GoldenDict work with its own Wiki ok.
This commit is contained in:
Konstantin Isakov 2009-05-18 18:46:18 +00:00
parent 4723831f5d
commit c09a353c99

View file

@ -288,7 +288,7 @@ void MediaWikiArticleRequest::requestFinished( QNetworkReply * r )
articleString.replace( QRegExp( "<a\\shref=\"(/(\\w*/)*index.php\\?)" ), articleString.replace( QRegExp( "<a\\shref=\"(/(\\w*/)*index.php\\?)" ),
QString( "<a href=\"%1\\1" ).arg( wikiUrl.toString() ) ); QString( "<a href=\"%1\\1" ).arg( wikiUrl.toString() ) );
// Replace the href="/foo/bar/Baz" to just href="Baz". // Replace the href="/foo/bar/Baz" to just href="Baz".
articleString.replace( QRegExp( "<a\\shref=\"/(\\w*/)*" ), "<a href=\"" ); articleString.replace( QRegExp( "<a\\shref=\"/([\\w\\.]*/)*" ), "<a href=\"" );
// In those strings, change any underscores to spaces // In those strings, change any underscores to spaces
for( ; ; ) for( ; ; )