Less indentation

main
Bob Mottram 2020-12-01 10:19:53 +00:00
parent aea95f131f
commit 963f8dc696
1 changed files with 50 additions and 41 deletions

View File

@ -588,7 +588,10 @@ def getPublishedDateStr(postJsonObject: {},
"""Return the html for the published date on a post """Return the html for the published date on a post
""" """
publishedStr = '' publishedStr = ''
if postJsonObject['object'].get('published'):
if not postJsonObject['object'].get('published'):
return publishedStr
publishedStr = postJsonObject['object']['published'] publishedStr = postJsonObject['object']['published']
if '.' not in publishedStr: if '.' not in publishedStr:
if '+' not in publishedStr: if '+' not in publishedStr:
@ -606,6 +609,7 @@ def getPublishedDateStr(postJsonObject: {},
publishedStr = datetimeObject.strftime("%a %b %d, %H:%M") publishedStr = datetimeObject.strftime("%a %b %d, %H:%M")
else: else:
publishedStr = datetimeObject.strftime("%a %b %d") publishedStr = datetimeObject.strftime("%a %b %d")
# if the post has replies then append a symbol to indicate this # if the post has replies then append a symbol to indicate this
if postJsonObject.get('hasReplies'): if postJsonObject.get('hasReplies'):
if postJsonObject['hasReplies'] is True: if postJsonObject['hasReplies'] is True:
@ -620,8 +624,12 @@ def getBlogCitationsHtml(boxName: str,
""" """
# show blog citations # show blog citations
citationsStr = '' citationsStr = ''
if boxName == 'tlblogs' or boxName == 'tlfeatures': if not (boxName == 'tlblogs' or boxName == 'tlfeatures'):
if postJsonObject['object'].get('tag'): return citationsStr
if not postJsonObject['object'].get('tag'):
return citationsStr
for tagJson in postJsonObject['object']['tag']: for tagJson in postJsonObject['object']['tag']:
if not isinstance(tagJson, dict): if not isinstance(tagJson, dict):
continue continue
@ -636,6 +644,7 @@ def getBlogCitationsHtml(boxName: str,
citationsStr += \ citationsStr += \
'<li><a href="' + tagJson['url'] + '">' + \ '<li><a href="' + tagJson['url'] + '">' + \
'<cite>' + tagJson['name'] + '</cite></a></li>\n' '<cite>' + tagJson['name'] + '</cite></a></li>\n'
if citationsStr: if citationsStr:
citationsStr = '<p><b>' + translate['Citations'] + \ citationsStr = '<p><b>' + translate['Citations'] + \
':</b></p>' + \ ':</b></p>' + \