css changes
This commit is contained in:
+10
-10
@@ -9,9 +9,15 @@ env = Environment( loader = PackageLoader("blahblah") )
|
|||||||
rollTemplate = env.get_template("roll_template.html.jinja")
|
rollTemplate = env.get_template("roll_template.html.jinja")
|
||||||
postTemplate = env.get_template("post_template.html.jinja")
|
postTemplate = env.get_template("post_template.html.jinja")
|
||||||
|
|
||||||
|
try:
|
||||||
with open('config.toml', 'r') as f:
|
with open('config.toml', 'r') as f:
|
||||||
config = toml.load(f)
|
config = toml.load(f)
|
||||||
|
except FileNotFoundError:
|
||||||
|
print('Error: config.toml not found (try renaming example.toml?). Exiting...')
|
||||||
|
sys.exit()
|
||||||
|
except:
|
||||||
|
print('An unknown error occurred. Exiting...')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
def generateBodies(db):
|
def generateBodies(db):
|
||||||
postCount = 0
|
postCount = 0
|
||||||
@@ -22,24 +28,18 @@ def generateBodies(db):
|
|||||||
newPost = '<div class="blobs mainbox blogpost">'
|
newPost = '<div class="blobs mainbox blogpost">'
|
||||||
newPost = newPost + "<h2>" + p["title"] + "</h2><br>"
|
newPost = newPost + "<h2>" + p["title"] + "</h2><br>"
|
||||||
else:
|
else:
|
||||||
newPost = '<div class="blobs mainbox micropost">'
|
newPost = '<div class="blobs mainbox blogpost micro">'
|
||||||
|
|
||||||
bodyText = p["body"]
|
bodyText = p["body"]
|
||||||
|
|
||||||
if len(bodyText) > 512:
|
if len(bodyText) > 512:
|
||||||
formattedBody = bodyText[0:512]
|
formattedBody = bodyText[0:509] + '...'
|
||||||
# formattedBody = markdown.markdown(formattedBody)
|
|
||||||
# bodyText = markdown.markdown(bodyText)
|
|
||||||
else:
|
else:
|
||||||
formattedBody = bodyText
|
formattedBody = bodyText
|
||||||
|
|
||||||
formattedBody = markdown.markdown(formattedBody)
|
formattedBody = markdown.markdown(formattedBody)
|
||||||
bodyText = markdown.markdown(bodyText)
|
bodyText = markdown.markdown(bodyText)
|
||||||
|
|
||||||
#newPost = newPost + formattedBody
|
|
||||||
|
|
||||||
#newPost = newPost + "</div>"
|
|
||||||
|
|
||||||
with open("./blog/posts/" + str(p["id"]) + ".html", "w") as f:
|
with open("./blog/posts/" + str(p["id"]) + ".html", "w") as f:
|
||||||
singlePost = newPost + bodyText
|
singlePost = newPost + bodyText
|
||||||
singlePost = singlePost + '</div>'
|
singlePost = singlePost + '</div>'
|
||||||
@@ -49,7 +49,7 @@ def generateBodies(db):
|
|||||||
newPost = newPost + formattedBody
|
newPost = newPost + formattedBody
|
||||||
newPost = newPost + '<p style="font-size:small;text-align:right">' + datetime.fromtimestamp(ts).strftime('%B %-d, %Y ')
|
newPost = newPost + '<p style="font-size:small;text-align:right">' + datetime.fromtimestamp(ts).strftime('%B %-d, %Y ')
|
||||||
newPost = newPost + '<a href="' + config['server']['document_root'] + "/blog/posts/" + str(p["id"]) + '.html">'
|
newPost = newPost + '<a href="' + config['server']['document_root'] + "/blog/posts/" + str(p["id"]) + '.html">'
|
||||||
newPost = newPost + 'permalink</a></p></div>'
|
newPost = newPost + 'link to full post</a></p></div>'
|
||||||
blogRoll.append(newPost)
|
blogRoll.append(newPost)
|
||||||
|
|
||||||
postCount += 1
|
postCount += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user