Include ending after ellipsis

main2
Bob Mottram 2019-10-01 11:47:47 +01:00
parent 3d9398609c
commit 7b29c456b9
1 changed files with 4 additions and 3 deletions

View File

@ -60,7 +60,6 @@ def addWebLinks(content: str) -> str:
return content
words=content.replace('\n',' --linebreak-- ').split(' ')
print(str(words))
replaceDict={}
for w in words:
if w.startswith('https://') or \
@ -78,8 +77,10 @@ def addWebLinks(content: str) -> str:
linkText=w.replace('https://','').replace('http://','').replace('dat://','')
# prevent links from becoming too long
if len(linkText)>40:
linkText=linkText[:40]
markup+='<span class="ellipsis">'+linkText+'</span></a>'
markup+='<span class="ellipsis">'+linkText[:40]+'</span>'
markup+='<span class="invisible">'+linkText[40:]+'</span></a>'
else:
markup+='<span class="ellipsis">'+linkText+'</span></a>'
replaceDict[w]=markup
for url,markup in replaceDict.items():
content=content.replace(url,markup)