From 708f1d8a2a81cf8407f7607594c8eadafc399f5d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 1 Oct 2019 09:54:52 +0100 Subject: [PATCH] Support dat links --- content.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/content.py b/content.py index 9e4ad275..7fb04c8a 100644 --- a/content.py +++ b/content.py @@ -62,7 +62,9 @@ def addWebLinks(content: str) -> str: words=content.replace('\n',' --linebreak--').split(' ') replaceDict={} for w in words: - if w.startswith('https://') or w.startswith('http://'): + if w.startswith('https://') or \ + w.startswith('http://') or \ + w.startswith('dat://'): if w.endswith('.') or w.endswith(';'): w=w[:-1] markup='' @@ -70,7 +72,9 @@ def addWebLinks(content: str) -> str: markup+='' elif w.startswith('http://'): markup+='' - linkText=w.replace('https://','').replace('http://','') + elif w.startswith('dat://'): + markup+='' + linkText=w.replace('https://','').replace('http://','').replace('dat://','') # prevent links from becoming too long if len(linkText)>50: linkText=linkText[:50]