Blog separator variable

main
Bob Mottram 2020-05-18 12:32:28 +01:00
parent 42c673e508
commit fa55703091
1 changed files with 27 additions and 17 deletions

18
blog.py
View File

@ -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='<hr>') -> str:
"""Returns the content for a single blog post
"""
linkedAuthor = False
@ -236,12 +237,21 @@ def htmlBlogPostContent(authorized: bool,
replies = noOfBlogReplies(baseDir, httpPrefix, translate,
nickname, domain, domainFull,
postJsonObject['object']['id'])
if replies > 0:
# separator between blogs should be centered
if '<center>' not in blogSeparator:
blogSeparator = '<center>' + blogSeparator + '</center>'
if replies == 0:
blogStr += blogSeparator + '\n'
return blogStr
if not authorized:
blogStr += '<p class="blogreplies">' + \
translate['Replies'].lower() + ': ' + str(replies) + '</p>'
blogStr += '<br><br><br>' + blogSeparator + '\n'
else:
blogStr += '<h1>' + translate['Replies'] + '</h1>\n'
blogStr += blogSeparator + '<h1>' + translate['Replies'] + '</h1>\n'
blogStr += '<script>' + contentWarningScriptOpen() + '</script>\n'
if not titleStr:
blogStr += getBlogReplies(baseDir, httpPrefix, translate,
@ -252,7 +262,7 @@ def htmlBlogPostContent(authorized: bool,
nickname, domain, domainFull,
postJsonObject['object']['id'])
blogStr += blogRepliesStr.replace('>' + titleStr + '<', '')
blogStr += '<br><br><hr>\n'
return blogStr