Open left column shared item in same tab

merge-requests/30/head
Bob Mottram 2021-07-28 20:16:42 +01:00
parent 28b3d5b020
commit 4a13a0685d
1 changed files with 19 additions and 10 deletions

View File

@ -168,6 +168,7 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
if linksList and sharesList: if linksList and sharesList:
linksList = sharesList + linksList linksList = sharesList + linksList
newTabStr = ' target="_blank" rel="nofollow noopener noreferrer"'
if linksList: if linksList:
htmlStr += '<nav>\n' htmlStr += '<nav>\n'
for lineStr in linksList: for lineStr in linksList:
@ -218,22 +219,30 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
if lineStr.endswith(','): if lineStr.endswith(','):
lineStr = lineStr[:len(lineStr)-1] lineStr = lineStr[:len(lineStr)-1]
# add link to the returned html # add link to the returned html
htmlStr += \ if '?showshare=' not in linkStr:
' <p><a href="' + linkStr + \ htmlStr += \
'" target="_blank" ' + \ ' <p><a href="' + linkStr + \
'rel="nofollow noopener noreferrer">' + \ '"' + newTabStr + '>' + \
lineStr + '</a></p>\n' lineStr + '</a></p>\n'
else:
htmlStr += \
' <p><a href="' + linkStr + \
'">' + lineStr + '</a></p>\n'
linksFileContainsEntries = True linksFileContainsEntries = True
elif lineStr.startswith('=> '): elif lineStr.startswith('=> '):
# gemini style link # gemini style link
lineStr = lineStr.replace('=> ', '') lineStr = lineStr.replace('=> ', '')
lineStr = lineStr.replace(linkStr, '') lineStr = lineStr.replace(linkStr, '')
# add link to the returned html # add link to the returned html
htmlStr += \ if '?showshare=' not in linkStr:
' <p><a href="' + linkStr + \ htmlStr += \
'" target="_blank" ' + \ ' <p><a href="' + linkStr + \
'rel="nofollow noopener noreferrer">' + \ '"' + newTabStr + '>' + \
lineStr.strip() + '</a></p>\n' lineStr.strip() + '</a></p>\n'
else:
htmlStr += \
' <p><a href="' + linkStr + \
'">' + lineStr.strip() + '</a></p>\n'
linksFileContainsEntries = True linksFileContainsEntries = True
else: else:
if lineStr.startswith('#') or lineStr.startswith('*'): if lineStr.startswith('#') or lineStr.startswith('*'):