mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
MDict: Fix links handling
This commit is contained in:
parent
d8eba31d2d
commit
81d56b73f9
22
mdx.cc
22
mdx.cc
|
@ -987,19 +987,15 @@ QString & MdxDictionary::filterResource( QString const & articleId, QString & ar
|
|||
if( pos < 0 )
|
||||
break;
|
||||
|
||||
if( wordCrossLink.cap( 3 ).isEmpty() )
|
||||
pos += wordCrossLink.cap( 0 ).size();
|
||||
else
|
||||
{
|
||||
QString newLink = wordCrossLink.cap( 1 )
|
||||
+ "gdlookup://localhost/"
|
||||
+ wordCrossLink.cap( 2 )
|
||||
+ ( wordCrossLink.cap( 3 ).isEmpty() ? "" : QString( "?gdanchor=" )
|
||||
+ uniquePrefix + wordCrossLink.cap( 3 ).mid( 1 )
|
||||
);
|
||||
article.replace( pos, wordCrossLink.cap( 0 ).size(), newLink );
|
||||
pos += newLink.size();
|
||||
}
|
||||
QString newLink = wordCrossLink.cap( 1 )
|
||||
+ "gdlookup://localhost/"
|
||||
+ wordCrossLink.cap( 2 );
|
||||
|
||||
if( !wordCrossLink.cap( 3 ).isEmpty() )
|
||||
newLink += QString( "?gdanchor=" ) + uniquePrefix + wordCrossLink.cap( 3 ).mid( 1 );
|
||||
|
||||
article.replace( pos, wordCrossLink.cap( 0 ).size(), newLink );
|
||||
pos += newLink.size();
|
||||
}
|
||||
|
||||
return article;
|
||||
|
|
Loading…
Reference in a new issue