Fix curly brackets in RSS feed
This commit is contained in:
parent
2559c429b1
commit
4484a22322
@ -3,6 +3,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import markdown
|
import markdown
|
||||||
|
from template import template, escape_braces
|
||||||
|
|
||||||
def gen_list(files, ext, limit=-1, mini=False):
|
def gen_list(files, ext, limit=-1, mini=False):
|
||||||
from template import template
|
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:
|
with open("posts/"+post, "r", encoding="utf-8") as file_in:
|
||||||
html = md.convert(file_in.read())
|
html = md.convert(file_in.read())
|
||||||
md.Meta["template"] = "post_preview" if not mini else "post_preview_mini"
|
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
|
i += 1
|
||||||
if limit >= 0 and i >= limit:
|
if limit >= 0 and i >= limit:
|
||||||
break;
|
break;
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
from template import template
|
|
||||||
meta = {"template": "post_list"}
|
meta = {"template": "post_list"}
|
||||||
ext = "."+sys.argv[2].split(".")[-1]
|
ext = "."+sys.argv[2].split(".")[-1]
|
||||||
files = sorted(os.listdir(sys.argv[1]), reverse=True)
|
files = sorted(os.listdir(sys.argv[1]), reverse=True)
|
||||||
|
@ -45,6 +45,9 @@ def read_template(template, meta_in):
|
|||||||
meta.update(md.Meta)
|
meta.update(md.Meta)
|
||||||
return [content, MetaDict(meta)]
|
return [content, MetaDict(meta)]
|
||||||
|
|
||||||
|
def escape_braces(s):
|
||||||
|
return s.replace("{","{{").replace("}","}}");
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
"base": "https://flewkey.com/",
|
"base": "https://flewkey.com/",
|
||||||
"title": "Untitled",
|
"title": "Untitled",
|
||||||
|
Loading…
Reference in New Issue
Block a user