From fa5570309112f9ef55b09691a3a739ff2b14353b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 18 May 2020 12:32:28 +0100 Subject: [PATCH] Blog separator variable --- blog.py | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/blog.py b/blog.py index 998a9ad2..aa551642 100644 --- a/blog.py +++ b/blog.py @@ -149,7 +149,8 @@ def htmlBlogPostContent(authorized: bool, baseDir: str, httpPrefix: str, translate: {}, nickname: str, domain: str, domainFull: str, postJsonObject: {}, - handle: str, restrictToDomain: bool) -> str: + handle: str, restrictToDomain: bool, + blogSeparator='
') -> str: """Returns the content for a single blog post """ linkedAuthor = False @@ -236,23 +237,32 @@ def htmlBlogPostContent(authorized: bool, replies = noOfBlogReplies(baseDir, httpPrefix, translate, nickname, domain, domainFull, postJsonObject['object']['id']) - if replies > 0: - if not authorized: - blogStr += '

' + \ - translate['Replies'].lower() + ': ' + str(replies) + '

' + + # separator between blogs should be centered + if '
' not in blogSeparator: + blogSeparator = '
' + blogSeparator + '
' + + if replies == 0: + blogStr += blogSeparator + '\n' + return blogStr + + if not authorized: + blogStr += '

' + \ + translate['Replies'].lower() + ': ' + str(replies) + '

' + blogStr += '


' + blogSeparator + '\n' + else: + blogStr += blogSeparator + '

' + translate['Replies'] + '

\n' + blogStr += '\n' + if not titleStr: + blogStr += getBlogReplies(baseDir, httpPrefix, translate, + nickname, domain, domainFull, + postJsonObject['object']['id']) else: - blogStr += '

' + translate['Replies'] + '

\n' - blogStr += '\n' - if not titleStr: - blogStr += getBlogReplies(baseDir, httpPrefix, translate, - nickname, domain, domainFull, - postJsonObject['object']['id']) - else: - blogRepliesStr = getBlogReplies(baseDir, httpPrefix, translate, - nickname, domain, domainFull, - postJsonObject['object']['id']) - blogStr += blogRepliesStr.replace('>' + titleStr + '<', '') - blogStr += '


\n' + blogRepliesStr = getBlogReplies(baseDir, httpPrefix, translate, + nickname, domain, domainFull, + postJsonObject['object']['id']) + blogStr += blogRepliesStr.replace('>' + titleStr + '<', '') + return blogStr