Link style

main
Bob Mottram 2021-07-20 11:46:58 +01:00
parent e3c696a0b3
commit e33eec9ff9
1 changed files with 5 additions and 1 deletions

View File

@ -241,13 +241,17 @@ def _libretranslate(url: str, text: str,
translatedText = \
'<p>' + json.loads(response_str)['translatedText'] + '</p>'
# append links form the original text
if links:
for url in links:
urlDesc = url
if len(urlDesc) > 30:
urlDesc = urlDesc[:30]
translatedText += \
'<p><a href="' + url + '">' + urlDesc + '</a></p>'
'<p><a href="' + url + \
'" rel="nofollow noopener noreferrer" target="_blank">' + \
urlDesc + '</a></p>'
return translatedText