From 4736d144f4ab136c3676cc5f0063e817f0ce75a1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Oct 2019 13:23:20 +0100 Subject: [PATCH] Tidying --- content.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content.py b/content.py index 703a2bc0f..15b53105f 100644 --- a/content.py +++ b/content.py @@ -59,6 +59,7 @@ def addWebLinks(content: str) -> str: if not ('https://' in content or 'http://' in content): return content + maxLinkLength=40 words=content.replace('\n',' --linebreak-- ').split(' ') replaceDict={} for w in words: @@ -76,9 +77,9 @@ def addWebLinks(content: str) -> str: markup+='' linkText=w.replace('https://','').replace('http://','').replace('dat://','') # prevent links from becoming too long - if len(linkText)>40: - markup+=''+linkText[:40]+'' - markup+='' + if len(linkText)>maxLinkLength: + markup+=''+linkText[:maxLinkLength]+'' + markup+='' else: markup+=''+linkText+'' replaceDict[w]=markup