MDict: Fix links handling

This commit is contained in:
Abs62 2015-10-30 22:21:35 +03:00
parent d8eba31d2d
commit 81d56b73f9

22
mdx.cc
View file

@ -987,19 +987,15 @@ QString & MdxDictionary::filterResource( QString const & articleId, QString & ar
if( pos < 0 ) if( pos < 0 )
break; break;
if( wordCrossLink.cap( 3 ).isEmpty() ) QString newLink = wordCrossLink.cap( 1 )
pos += wordCrossLink.cap( 0 ).size(); + "gdlookup://localhost/"
else + wordCrossLink.cap( 2 );
{
QString newLink = wordCrossLink.cap( 1 ) if( !wordCrossLink.cap( 3 ).isEmpty() )
+ "gdlookup://localhost/" newLink += QString( "?gdanchor=" ) + uniquePrefix + wordCrossLink.cap( 3 ).mid( 1 );
+ wordCrossLink.cap( 2 )
+ ( wordCrossLink.cap( 3 ).isEmpty() ? "" : QString( "?gdanchor=" ) article.replace( pos, wordCrossLink.cap( 0 ).size(), newLink );
+ uniquePrefix + wordCrossLink.cap( 3 ).mid( 1 ) pos += newLink.size();
);
article.replace( pos, wordCrossLink.cap( 0 ).size(), newLink );
pos += newLink.size();
}
} }
return article; return article;