mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-18 03:14:06 +00:00
Wiki: Handle inter-article anchors
This commit is contained in:
parent
81d56b73f9
commit
cf3ec5dfc1
|
@ -358,7 +358,11 @@ void MediaWikiArticleRequest::requestFinished( QNetworkReply * r )
|
||||||
|
|
||||||
int n = link.indexOf( '#', 1 );
|
int n = link.indexOf( '#', 1 );
|
||||||
if( n > 0 )
|
if( n > 0 )
|
||||||
|
{
|
||||||
|
QString anchor = link.mid( n + 1 ).replace( '_', "%5F" );
|
||||||
link.truncate( n );
|
link.truncate( n );
|
||||||
|
link += QString( "?gdanchor=%1" ).arg( anchor );
|
||||||
|
}
|
||||||
|
|
||||||
QString newLink = QString( "<a href=\"/%1\"" ).arg( link );
|
QString newLink = QString( "<a href=\"/%1\"" ).arg( link );
|
||||||
articleString.replace( pos, regLinks.cap().size(), newLink );
|
articleString.replace( pos, regLinks.cap().size(), newLink );
|
||||||
|
|
Loading…
Reference in a new issue