Indentation

merge-requests/30/head
Bob Mottram 2020-09-30 21:41:33 +01:00
parent e638d4d7c5
commit 0274ed7fa6
1 changed files with 24 additions and 24 deletions

View File

@ -101,10 +101,10 @@ def getContentWarningButton(postID: str, translate: {},
content: str) -> str: content: str) -> str:
"""Returns the markup for a content warning button """Returns the markup for a content warning button
""" """
return '<details><summary><b>' + \ return ' <details><summary><b>' + \
translate['SHOW MORE'] + '</b></summary>' + \ translate['SHOW MORE'] + '</b></summary>' + \
'<div id="' + postID + '">' + content + \ '<div id="' + postID + '">' + content + \
'</div></details>' '</div></details>\n'
def getBlogAddress(actorJson: {}) -> str: def getBlogAddress(actorJson: {}) -> str:
@ -4230,7 +4230,7 @@ def individualPostAsHtml(allowDownloads: bool,
nickname, domain, nickname, domain,
displayName, False) displayName, False)
titleStr += \ titleStr += \
'<a class="imageAnchor" href="/users/' + \ ' <a class="imageAnchor" href="/users/' + \
nickname + '?options=' + postActor + \ nickname + '?options=' + postActor + \
';' + str(pageNumber) + ';' + avatarUrl + messageIdStr + \ ';' + str(pageNumber) + ';' + avatarUrl + messageIdStr + \
'">' + displayName + '</a>\n' '">' + displayName + '</a>\n'
@ -4245,7 +4245,7 @@ def individualPostAsHtml(allowDownloads: bool,
# pprint(postJsonObject) # pprint(postJsonObject)
print('ERROR: no actorDomain') print('ERROR: no actorDomain')
titleStr += \ titleStr += \
'<a class="imageAnchor" href="/users/' + \ ' <a class="imageAnchor" href="/users/' + \
nickname + '?options=' + postActor + \ nickname + '?options=' + postActor + \
';' + str(pageNumber) + ';' + avatarUrl + messageIdStr + \ ';' + str(pageNumber) + ';' + avatarUrl + messageIdStr + \
'">@' + actorNickname + '@' + actorDomain + '</a>\n' '">@' + actorNickname + '@' + actorDomain + '</a>\n'
@ -4289,20 +4289,20 @@ def individualPostAsHtml(allowDownloads: bool,
replyStr = '' replyStr = ''
if isPublicRepeat: if isPublicRepeat:
replyStr += \ replyStr += \
'<a class="imageAnchor" href="/users/' + \ ' <a class="imageAnchor" href="/users/' + \
nickname + '?replyto=' + replyToLink + \ nickname + '?replyto=' + replyToLink + \
'?actor=' + postJsonObject['actor'] + \ '?actor=' + postJsonObject['actor'] + \
'" title="' + translate['Reply to this post'] + '">\n' '" title="' + translate['Reply to this post'] + '">\n'
else: else:
if isDM(postJsonObject): if isDM(postJsonObject):
replyStr += \ replyStr += \
'<a class="imageAnchor" href="/users/' + nickname + \ ' <a class="imageAnchor" href="/users/' + nickname + \
'?replydm=' + replyToLink + \ '?replydm=' + replyToLink + \
'?actor=' + postJsonObject['actor'] + \ '?actor=' + postJsonObject['actor'] + \
'" title="' + translate['Reply to this post'] + '">\n' '" title="' + translate['Reply to this post'] + '">\n'
else: else:
replyStr += \ replyStr += \
'<a class="imageAnchor" href="/users/' + nickname + \ ' <a class="imageAnchor" href="/users/' + nickname + \
'?replyfollowers=' + replyToLink + \ '?replyfollowers=' + replyToLink + \
'?actor=' + postJsonObject['actor'] + \ '?actor=' + postJsonObject['actor'] + \
'" title="' + translate['Reply to this post'] + '">\n' '" title="' + translate['Reply to this post'] + '">\n'
@ -4333,7 +4333,7 @@ def individualPostAsHtml(allowDownloads: bool,
if isBlogPost(postJsonObject): if isBlogPost(postJsonObject):
blogPostId = postJsonObject['object']['id'] blogPostId = postJsonObject['object']['id']
editStr += \ editStr += \
'<a class="imageAnchor" href="/users/' + nickname + \ ' <a class="imageAnchor" href="/users/' + nickname + \
'/tlblogs?editblogpost=' + \ '/tlblogs?editblogpost=' + \
blogPostId.split('/statuses/')[1] + \ blogPostId.split('/statuses/')[1] + \
'?actor=' + actorNickname + \ '?actor=' + actorNickname + \
@ -4345,7 +4345,7 @@ def individualPostAsHtml(allowDownloads: bool,
elif isEvent: elif isEvent:
eventPostId = postJsonObject['object']['id'] eventPostId = postJsonObject['object']['id']
editStr += \ editStr += \
'<a class="imageAnchor" href="/users/' + nickname + \ ' <a class="imageAnchor" href="/users/' + nickname + \
'/tlblogs?editeventpost=' + \ '/tlblogs?editeventpost=' + \
eventPostId.split('/statuses/')[1] + \ eventPostId.split('/statuses/')[1] + \
'?actor=' + actorNickname + \ '?actor=' + actorNickname + \
@ -4369,7 +4369,7 @@ def individualPostAsHtml(allowDownloads: bool,
announceLink = 'unrepeatprivate' announceLink = 'unrepeatprivate'
announceTitle = translate['Undo the repeat'] announceTitle = translate['Undo the repeat']
announceStr = \ announceStr = \
'<a class="imageAnchor" href="/users/' + \ ' <a class="imageAnchor" href="/users/' + \
nickname + '?' + announceLink + \ nickname + '?' + announceLink + \
'=' + postJsonObject['object']['id'] + pageNumberParam + \ '=' + postJsonObject['object']['id'] + pageNumberParam + \
'?actor=' + postJsonObject['actor'] + \ '?actor=' + postJsonObject['actor'] + \
@ -4433,7 +4433,7 @@ def individualPostAsHtml(allowDownloads: bool,
likeStr += likeCountStr.replace('(', '').replace(')', '').strip() likeStr += likeCountStr.replace('(', '').replace(')', '').strip()
likeStr += '</label>\n' likeStr += '</label>\n'
likeStr += \ likeStr += \
'<a class="imageAnchor" href="/users/' + nickname + '?' + \ ' <a class="imageAnchor" href="/users/' + nickname + '?' + \
likeLink + '=' + postJsonObject['object']['id'] + \ likeLink + '=' + postJsonObject['object']['id'] + \
pageNumberParam + \ pageNumberParam + \
'?actor=' + postJsonObject['actor'] + \ '?actor=' + postJsonObject['actor'] + \
@ -4466,7 +4466,7 @@ def individualPostAsHtml(allowDownloads: bool,
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 12.6 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 12.6 = ' + str(timeDiff))
bookmarkStr = \ bookmarkStr = \
'<a class="imageAnchor" href="/users/' + nickname + '?' + \ ' <a class="imageAnchor" href="/users/' + nickname + '?' + \
bookmarkLink + '=' + postJsonObject['object']['id'] + \ bookmarkLink + '=' + postJsonObject['object']['id'] + \
pageNumberParam + \ pageNumberParam + \
'?actor=' + postJsonObject['actor'] + \ '?actor=' + postJsonObject['actor'] + \
@ -4498,7 +4498,7 @@ def individualPostAsHtml(allowDownloads: bool,
messageId.startswith(postActor))): messageId.startswith(postActor))):
if '/users/' + nickname + '/' in messageId: if '/users/' + nickname + '/' in messageId:
deleteStr = \ deleteStr = \
'<a class="imageAnchor" href="/users/' + nickname + \ ' <a class="imageAnchor" href="/users/' + nickname + \
'?delete=' + messageId + pageNumberParam + \ '?delete=' + messageId + pageNumberParam + \
'" title="' + translate['Delete this post'] + '">\n' '" title="' + translate['Delete this post'] + '">\n'
deleteStr += \ deleteStr += \
@ -4508,7 +4508,7 @@ def individualPostAsHtml(allowDownloads: bool,
else: else:
if not isMuted: if not isMuted:
muteStr = \ muteStr = \
'<a class="imageAnchor" href="/users/' + nickname + \ ' <a class="imageAnchor" href="/users/' + nickname + \
'?mute=' + messageId + pageNumberParam + '?tl=' + boxName + \ '?mute=' + messageId + pageNumberParam + '?tl=' + boxName + \
'?bm=' + timelinePostBookmark + \ '?bm=' + timelinePostBookmark + \
'" title="' + translate['Mute this post'] + '">\n' '" title="' + translate['Mute this post'] + '">\n'
@ -4519,7 +4519,7 @@ def individualPostAsHtml(allowDownloads: bool,
'" src="/' + iconsDir + '/mute.png"/></a>\n' '" src="/' + iconsDir + '/mute.png"/></a>\n'
else: else:
muteStr = \ muteStr = \
'<a class="imageAnchor" href="/users/' + \ ' <a class="imageAnchor" href="/users/' + \
nickname + '?unmute=' + messageId + \ nickname + '?unmute=' + messageId + \
pageNumberParam + '?tl=' + boxName + '?bm=' + \ pageNumberParam + '?tl=' + boxName + '?bm=' + \
timelinePostBookmark + '" title="' + \ timelinePostBookmark + '" title="' + \
@ -4617,7 +4617,7 @@ def individualPostAsHtml(allowDownloads: bool,
replyAvatarImageInPost = \ replyAvatarImageInPost = \
' ' \ ' ' \
'<div class="timeline-avatar-reply">\n' \ '<div class="timeline-avatar-reply">\n' \
'<a class="imageAnchor" ' + \ ' <a class="imageAnchor" ' + \
'href="/users/' + nickname + \ 'href="/users/' + nickname + \
'?options=' + \ '?options=' + \
announceActor + ';' + str(pageNumber) + \ announceActor + ';' + str(pageNumber) + \
@ -4627,10 +4627,10 @@ def individualPostAsHtml(allowDownloads: bool,
announceAvatarUrl + '" ' \ announceAvatarUrl + '" ' \
'title="' + translate[idx] + \ 'title="' + translate[idx] + \
'" alt=" "' + avatarPosition + \ '" alt=" "' + avatarPosition + \
'/></a>\n</div>\n' '/></a>\n </div>\n'
else: else:
titleStr += \ titleStr += \
' <img loading="lazy" title="' + \ ' <img loading="lazy" title="' + \
translate['announces'] + \ translate['announces'] + \
'" alt="' + translate['announces'] + \ '" alt="' + translate['announces'] + \
'" src="/' + iconsDir + \ '" src="/' + iconsDir + \
@ -4641,7 +4641,7 @@ def individualPostAsHtml(allowDownloads: bool,
announceDomain + '</a>\n' announceDomain + '</a>\n'
else: else:
titleStr += \ titleStr += \
' <img loading="lazy" title="' + \ ' <img loading="lazy" title="' + \
translate['announces'] + '" alt="' + \ translate['announces'] + '" alt="' + \
translate['announces'] + '" src="/' + iconsDir + \ translate['announces'] + '" src="/' + iconsDir + \
'/repeat_inactive.png" ' + \ '/repeat_inactive.png" ' + \
@ -4650,7 +4650,7 @@ def individualPostAsHtml(allowDownloads: bool,
'">@unattributed</a>\n' '">@unattributed</a>\n'
else: else:
titleStr += \ titleStr += \
' <img loading="lazy" title="' + translate['announces'] + \ ' <img loading="lazy" title="' + translate['announces'] + \
'" alt="' + translate['announces'] + \ '" alt="' + translate['announces'] + \
'" src="/' + iconsDir + \ '" src="/' + iconsDir + \
'/repeat_inactive.png" ' + \ '/repeat_inactive.png" ' + \
@ -4662,7 +4662,7 @@ def individualPostAsHtml(allowDownloads: bool,
containerClass = 'container darker' containerClass = 'container darker'
if postJsonObject['object']['inReplyTo'].startswith(postActor): if postJsonObject['object']['inReplyTo'].startswith(postActor):
titleStr += \ titleStr += \
' <img loading="lazy" title="' + \ ' <img loading="lazy" title="' + \
translate['replying to themselves'] + \ translate['replying to themselves'] + \
'" alt="' + translate['replying to themselves'] + \ '" alt="' + translate['replying to themselves'] + \
'" src="/' + iconsDir + \ '" src="/' + iconsDir + \
@ -4866,12 +4866,12 @@ def individualPostAsHtml(allowDownloads: bool,
containerClass = 'container dm' containerClass = 'container dm'
if showIcons: if showIcons:
footerStr = '<div class="' + containerClassIcons + '">' footerStr = ' <div class="' + containerClassIcons + '">\n'
footerStr += replyStr + announceStr + likeStr + bookmarkStr + \ footerStr += replyStr + announceStr + likeStr + bookmarkStr + \
deleteStr + muteStr + editStr deleteStr + muteStr + editStr
footerStr += '<a href="' + publishedLink + '" class="' + \ footerStr += ' <a href="' + publishedLink + '" class="' + \
timeClass + '">' + publishedStr + '</a>\n' timeClass + '">' + publishedStr + '</a>\n'
footerStr += '</div>' footerStr += ' </div>\n'
postIsSensitive = False postIsSensitive = False
if postJsonObject['object'].get('sensitive'): if postJsonObject['object'].get('sensitive'):