From 4484a2232250092647153918c4201beac141f1c0 Mon Sep 17 00:00:00 2001 From: Ryan Fox Date: Thu, 31 Dec 2020 00:28:22 +0000 Subject: [PATCH] Fix curly brackets in RSS feed --- scripts/gen_blog.py | 4 ++-- scripts/template.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/gen_blog.py b/scripts/gen_blog.py index 594ee66..6893b4f 100755 --- a/scripts/gen_blog.py +++ b/scripts/gen_blog.py @@ -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) diff --git a/scripts/template.py b/scripts/template.py index 02beb47..b35e9b4 100644 --- a/scripts/template.py +++ b/scripts/template.py @@ -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",