From a6dc579aca821ecdca99073eba6ecae27a3e2908 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 3 Nov 2019 12:37:47 +0000 Subject: [PATCH] Support dat --- content.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/content.py b/content.py index 45e13e000..586e00bcb 100644 --- a/content.py +++ b/content.py @@ -30,13 +30,13 @@ def addMusicTag(content: str,tag: str) -> str: def addWebLinks(content: str) -> str: """Adds markup for web links """ - if not ('https://' in content or 'http://' in content): + if not ('https://' in content or 'http://' in content or 'dat://' in content): return content 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='' @@ -44,7 +44,9 @@ def addWebLinks(content: str) -> str: markup+='' elif w.startswith('http://'): markup+='' - markup+=''+w.replace('https://','').replace('http://','')+'' + elif w.startswith('dat://'): + markup+='' + markup+=''+w.replace('https://','').replace('http://','').replace('dat://','')+'' replaceDict[w]=markup for url,markup in replaceDict.items(): content=content.replace(url,markup)