Remove css load from blog

main
Bob Mottram 2020-11-12 16:05:45 +00:00
parent a7bbe4a7d9
commit 96ed5f2696
1 changed files with 126 additions and 140 deletions

24
blog.py
View File

@ -11,7 +11,7 @@ from datetime import datetime
from content import replaceEmojiFromTags
from webapp import getIconsDir
from webapp import htmlHeader
from webapp import htmlHeaderWithExternalStyle
from webapp import htmlFooter
from webapp_media import addEmbeddedElements
from webapp_utils import getPostAttachmentsAsHtml
@ -381,9 +381,7 @@ def htmlBlogPost(authorized: bool,
cssFilename = baseDir + '/epicyon-blog.css'
if os.path.isfile(baseDir + '/blog.css'):
cssFilename = baseDir + '/blog.css'
with open(cssFilename, 'r') as cssFile:
blogCSS = cssFile.read()
blogStr = htmlHeader(cssFilename, blogCSS)
blogStr = htmlHeaderWithExternalStyle(cssFilename)
htmlBlogRemoveCwButton(blogStr, translate)
blogStr += htmlBlogPostContent(authorized, baseDir,
@ -413,7 +411,6 @@ def htmlBlogPost(authorized: bool,
blogStr += '</p>'
return blogStr + htmlFooter()
return None
def htmlBlogPage(authorized: bool, session,
@ -430,9 +427,7 @@ def htmlBlogPage(authorized: bool, session,
cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
with open(cssFilename, 'r') as cssFile:
blogCSS = cssFile.read()
blogStr = htmlHeader(cssFilename, blogCSS)
blogStr = htmlHeaderWithExternalStyle(cssFilename)
htmlBlogRemoveCwButton(blogStr, translate)
blogsIndex = baseDir + '/accounts/' + \
@ -506,9 +501,7 @@ def htmlBlogPage(authorized: bool, session,
# iconsDir + '/rss3.png" /></a>'
blogStr += '</p>'
return blogStr + htmlFooter()
return None
def htmlBlogPageRSS2(authorized: bool, session,
@ -678,9 +671,7 @@ def htmlBlogView(authorized: bool,
cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
with open(cssFilename, 'r') as cssFile:
blogCSS = cssFile.read()
blogStr = htmlHeader(cssFilename, blogCSS)
blogStr = htmlHeaderWithExternalStyle(cssFilename)
if noOfBlogAccounts(baseDir) <= 1:
nickname = singleBlogAccountNickname(baseDir)
@ -711,7 +702,6 @@ def htmlBlogView(authorized: bool,
blogStr += '</p>'
return blogStr + htmlFooter()
return None
def htmlEditBlog(mediaInstance: bool, translate: {},
@ -744,10 +734,6 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = baseDir + '/epicyon.css'
with open(cssFilename, 'r') as cssFile:
editBlogCSS = cssFile.read()
if httpPrefix != 'https':
editBlogCSS = editBlogCSS.replace('https://', httpPrefix+'://')
if '?' in path:
path = path.split('?')[0]
@ -794,7 +780,7 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
dateAndLocation += '<input type="text" name="location">'
dateAndLocation += '</div>'
editBlogForm = htmlHeader(cssFilename, editBlogCSS)
editBlogForm = htmlHeaderWithExternalStyle(cssFilename)
editBlogForm += \
'<form enctype="multipart/form-data" method="POST" ' + \