all repos — site @ f55fc2f7d72477266abfbfefa9c2fc2003c8cc8b

source for my site, found at icyphox.sh

rss.py (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
#!/usr/bin/env python3

import html
from markdown2 import markdown_path
import sys
import os

mdfile = sys.argv[1]
url =  os.path.splitext(mdfile)[0]
rendered = markdown_path(os.path.join('pages/blog/', mdfile), extras=['metadata', 
        'fenced-code-blocks', 'header-ids', 'footnotes', 'smarty-pants'])
meta = rendered.metadata
esc = html.escape(rendered)

item = f"""<item>
      <title>{meta['title']}</title>
      <description>{esc}</description>
      <guid isPermaLink="false">https://icyphox.sh/blog/{url}/</guid>
</item>
"""

print(item)