mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
DSL: Add "http://" to link in [url] tag if it scheme not found
This commit is contained in:
parent
f2ebba10fe
commit
66c309557d
7
dsl.cc
7
dsl.cc
|
@ -893,7 +893,12 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
|
|||
}
|
||||
else
|
||||
if ( node.tagName == GD_NATIVE_TO_WS( L"url" ) )
|
||||
result += "<a class=\"dsl_url\" href=\"" + Html::escape( Utf8::encode( node.renderAsText() ) ) +"\">" + processNodeChildren( node ) + "</a>";
|
||||
{
|
||||
string link = Html::escape( Utf8::encode( node.renderAsText() ) );
|
||||
if( QUrl::fromEncoded( link.c_str() ).scheme().isEmpty() )
|
||||
link = "http://" + link;
|
||||
result += "<a class=\"dsl_url\" href=\"" + link +"\">" + processNodeChildren( node ) + "</a>";
|
||||
}
|
||||
else
|
||||
if ( node.tagName == GD_NATIVE_TO_WS( L"!trs" ) )
|
||||
result += "<span class=\"dsl_trs\">" + processNodeChildren( node ) + "</span>";
|
||||
|
|
Loading…
Reference in a new issue