From 0c2c40c76f78cf8807d49e3aa77b6aa9fa151fe6 Mon Sep 17 00:00:00 2001 From: nathansmith Date: Sat, 29 Mar 2025 03:24:52 -0600 Subject: Working on blog --- blog/articles/test.xml | 8 ++++++++ blog/feed.xml | 31 +++++++++++++++++++++++++++++++ blog/generate.py | 30 ++++++++++++++++++++++++++++++ blog/template.html | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 115 insertions(+) create mode 100644 blog/articles/test.xml create mode 100644 blog/feed.xml create mode 100755 blog/generate.py create mode 100644 blog/template.html (limited to 'blog') diff --git a/blog/articles/test.xml b/blog/articles/test.xml new file mode 100644 index 0000000..51d440b --- /dev/null +++ b/blog/articles/test.xml @@ -0,0 +1,8 @@ +
+
+

Over thinking

+

+ I over think a lot tbh. +

+
+
diff --git a/blog/feed.xml b/blog/feed.xml new file mode 100644 index 0000000..a504f41 --- /dev/null +++ b/blog/feed.xml @@ -0,0 +1,31 @@ + + + + Nathan's shitty blog + The coffee powered blog of chaos + http://nathansmith117.beevomit.org/blog + + http://nathansmith117.bevomit.org/images/icon.png + Nathan's shitty blog + http://nathansmith117.beevomit.org + + + + test post + http://nathansmith117.bevomit.or/blog + Sat, 29 Mar 2025 00:00:00 GMT + + +
+

Over thinking

+

+ I over think a lot tbh. +

+
+ + ]]> +
+
+
+
diff --git a/blog/generate.py b/blog/generate.py new file mode 100755 index 0000000..3471ef9 --- /dev/null +++ b/blog/generate.py @@ -0,0 +1,30 @@ +#! /usr/bin/python3 + +""" +A script to generate html from the rss feed +""" + +import xml.etree.ElementTree as et + +def main(): + tree = et.parse("feed.xml") + root = tree.getroot() + channel = root[0] + + template = "" + + # Open html template + with open("template.html", "r") as fp: + template = fp.read() + + # Get articles from rss + for item in channel.findall("item"): + article = item.find("description").text + + # Remove article tags. + article = article[article.find("
")+9::] + article = article[:article.find("
"):] + print(article) + +if __name__ == "__main__": + main() diff --git a/blog/template.html b/blog/template.html new file mode 100644 index 0000000..719d3f3 --- /dev/null +++ b/blog/template.html @@ -0,0 +1,46 @@ + + + + + Nathan's shitty blog + + + + + + + + Back to home page + +
+ + + + +
+

Nathan's shitty blog

+

+

+
+ + + {articles} +
+ + -- cgit v1.2.3