Prevent links from becoming too long

main2
Bob Mottram 2019-09-18 09:37:42 +01:00
parent 0920dbdcbe
commit 50e9417d87
1 changed files with 5 additions and 1 deletions

View File

@ -44,7 +44,11 @@ def addWebLinks(content: str) -> str:
markup+='<span class="invisible">https://</span>'
elif w.startswith('http://'):
markup+='<span class="invisible">http://</span>'
markup+='<span class="ellipsis">'+w.replace('https://','').replace('http://','')+'</span></a>'
linkText=w.replace('https://','').replace('http://','')
# prevent links from becoming too long
if len(linkText)>50:
linkText=linkText[:50]
markup+='<span class="ellipsis">'+linkText+'</span></a>'
replaceDict[w]=markup
for url,markup in replaceDict.items():
content=content.replace(url,markup)