1
0

Fix curly brackets in RSS feed

This commit is contained in:
Ryan Fox 2020-12-31 00:28:22 +00:00
parent 2559c429b1
commit 4484a22322
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
2 changed files with 5 additions and 2 deletions

View File

@ -3,6 +3,7 @@
import os
import sys
import markdown
from template import template, escape_braces
def gen_list(files, ext, limit=-1, mini=False):
from template import template
@ -13,14 +14,13 @@ def gen_list(files, ext, limit=-1, mini=False):
with open("posts/"+post, "r", encoding="utf-8") as file_in:
html = md.convert(file_in.read())
md.Meta["template"] = "post_preview" if not mini else "post_preview_mini"
items += template(html, "blog/"+post[:-3]+ext, ext, md.Meta)
items += template(escape_braces(html), "blog/"+post[:-3]+ext, ext, md.Meta)
i += 1
if limit >= 0 and i >= limit:
break;
return items
def main():
from template import template
meta = {"template": "post_list"}
ext = "."+sys.argv[2].split(".")[-1]
files = sorted(os.listdir(sys.argv[1]), reverse=True)

View File

@ -45,6 +45,9 @@ def read_template(template, meta_in):
meta.update(md.Meta)
return [content, MetaDict(meta)]
def escape_braces(s):
return s.replace("{","{{").replace("}","}}");
defaults = {
"base": "https://flewkey.com/",
"title": "Untitled",