Remove the CW button from blog posts

main
Bob Mottram 2020-07-03 11:07:11 +01:00
parent 0c1df23d13
commit e81f7e618e
1 changed files with 14 additions and 0 deletions

14
blog.py
View File

@ -316,6 +316,18 @@ def htmlBlogPostRSS3(authorized: bool,
return rssStr
def htmlBlogRemoveCwButton(blogStr: str, translate: {}) -> str:
"""Removes the CW button from blog posts, where the
summary field is instead used as the blog title
"""
blogStr = blogStr.replace('<details>', '<b>')
blogStr = blogStr.replace('</details>', '</b>')
blogStr = blogStr.replace('<summary>', '')
blogStr = blogStr.replace('</summary>', '')
blogStr = blogStr.replace(translate['SHOW MORE'], '')
return blogStr
def htmlBlogPost(authorized: bool,
baseDir: str, httpPrefix: str, translate: {},
nickname: str, domain: str, domainFull: str,
@ -330,6 +342,7 @@ def htmlBlogPost(authorized: bool,
with open(cssFilename, 'r') as cssFile:
blogCSS = cssFile.read()
blogStr = htmlHeader(cssFilename, blogCSS)
htmlBlogRemoveCwButton(blogStr, translate)
blogStr += htmlBlogPostContent(authorized, baseDir,
httpPrefix, translate,
@ -376,6 +389,7 @@ def htmlBlogPage(authorized: bool, session,
with open(cssFilename, 'r') as cssFile:
blogCSS = cssFile.read()
blogStr = htmlHeader(cssFilename, blogCSS)
htmlBlogRemoveCwButton(blogStr, translate)
blogsIndex = baseDir + '/accounts/' + \
nickname + '@' + domain + '/tlblogs.index'