Also support gopher links

main
Bob Mottram 2020-05-06 16:15:03 +01:00
parent 80936d88a3
commit 0f1ad061ec
1 changed files with 4 additions and 0 deletions

View File

@ -137,6 +137,7 @@ def addWebLinks(content: str) -> str:
w.startswith('http://') or \ w.startswith('http://') or \
w.startswith('i2p://') or \ w.startswith('i2p://') or \
w.startswith('gemini://') or \ w.startswith('gemini://') or \
w.startswith('gopher://') or \
w.startswith('dat://'): w.startswith('dat://'):
if w.endswith('.') or w.endswith(';'): if w.endswith('.') or w.endswith(';'):
w = w[:-1] w = w[:-1]
@ -152,9 +153,12 @@ def addWebLinks(content: str) -> str:
markup += '<span class="invisible">dat://</span>' markup += '<span class="invisible">dat://</span>'
elif w.startswith('gemini://'): elif w.startswith('gemini://'):
markup += '<span class="invisible">gemini://</span>' markup += '<span class="invisible">gemini://</span>'
elif w.startswith('gopher://'):
markup += '<span class="invisible">gopher://</span>'
linkText = w.replace('https://', '').replace('http://', '') linkText = w.replace('https://', '').replace('http://', '')
linkText = linkText.replace('dat://', '').replace('i2p://', '') linkText = linkText.replace('dat://', '').replace('i2p://', '')
linkText = linkText.replace('gemini://', '') linkText = linkText.replace('gemini://', '')
linkText = linkText.replace('gopher://', '')
# prevent links from becoming too long # prevent links from becoming too long
if len(linkText) > maxLinkLength: if len(linkText) > maxLinkLength:
markup += '<span class="ellipsis">' + \ markup += '<span class="ellipsis">' + \