rss.py (view raw)
1#!/usr/bin/env python3
2
3import html
4from markdown2 import markdown_path
5import sys
6import os
7
8mdfile = sys.argv[1]
9url = os.path.splitext(mdfile)[0]
10rendered = markdown_path(os.path.join('pages/blog/', mdfile), extras=['metadata',
11 'fenced-code-blocks', 'header-ids', 'footnotes', 'smarty-pants'])
12meta = rendered.metadata
13esc = html.escape(rendered)
14
15item = f"""<item>
16 <title>{meta['title']}</title>
17 <description>{esc}</description>
18 <guid isPermaLink="false">https://icyphox.sh/blog/{url}/</guid>
19</item>
20"""
21
22print(item)