diff --git a/blog.py b/blog.py index 68d0b55d2..2641ec5b2 100644 --- a/blog.py +++ b/blog.py @@ -18,6 +18,7 @@ from shutil import copyfileobj from pprint import pprint from content import replaceEmojiFromTags +from webinterface import contentWarningScriptOpen from webinterface import getIconsDir from webinterface import getPostAttachmentsAsHtml from webinterface import htmlHeader @@ -69,7 +70,7 @@ def getBlogReplies(baseDir: str,httpPrefix: str,translate: {}, \ if not os.path.isfile(postFilename): continue with open(postFilename, "r") as postFile: - repliesStr+=postFile.read() + repliesStr+=postFile.read()+'\n' return repliesStr return '' @@ -165,9 +166,10 @@ def htmlBlogPostContent(authorized: bool, \ if replies>0: blogStr+= \ '

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

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

\n' else: - blogStr+='

'+translate['Replies']+'

' + blogStr+='

'+translate['Replies']+'

\n' + blogStr+='\n' blogStr+= \ getBlogReplies(baseDir,httpPrefix,translate, \ nickname,domain,domainFull, \ diff --git a/webinterface.py b/webinterface.py index 7ad3d3895..247dc03ff 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2141,6 +2141,20 @@ def contentWarningScript() -> str: script+='}\n' return script +def contentWarningScriptOpen() -> str: + """Returns a script used for content warnings + The warning is open by default. This is used on blog replies. + """ + script='function showContentWarning(postID) {\n' + script+=' var x = document.getElementById(postID);\n' + script+=' if (x.style.display !== "none") {\n' + script+=' x.style.display = "none";\n' + script+=' } else {\n' + script+=' x.style.display = "block";\n' + script+=' }\n' + script+='}\n' + return script + def addEmbeddedAudio(translate: {},content: str) -> str: """Adds embedded audio for mp3/ogg """