Commit

Author:

Hash:

Timestamp:

+4 -7 +/-1 browse

Kevin Schoon [me@kevinschoon.com]

c66a3286037103296dd751904e441c8d9ce2f7e3

Fri, 28 Nov 2025 23:20:45 +0000 (1 day ago)

fix xmlns tags in atom feed
1diff --git a/render.py b/render.py
2index 29a2081..1a624f3 100755
3--- a/render.py
4+++ b/render.py
5 @@ -177,10 +177,6 @@ def generate(template, content_path, stylesheet, link, sitemap, devmode=False):
6 def generate_rss(sitemap):
7 sitemap = _load_sitemap(sitemap, "/")
8
9- header = ET.Element(
10- "xml-stylesheet", attrib={"href": "/feed.xsl", "type": "text/xsl"}
11- )
12-
13 feed = ET.Element("feed", attrib={"xmlns": "http://www.w3.org/2005/Atom"})
14
15 feed_id = ET.SubElement(feed, "id")
16 @@ -206,15 +202,16 @@ def generate_rss(sitemap):
17 _id.text = absolute_url
18 title = ET.SubElement(atom_entry, "title")
19 title.text = entry["tagline"]
20+ updated = ET.SubElement(atom_entry, "updated")
21+ updated.text = entry["date"].isoformat()
22 content_path = "content/blog/" + entry["name"] + "/README.md"
23 content = load_content(content_path)
24 content_element = ET.SubElement(atom_entry, "content")
25 content_element.attrib["type"] = "xhtml"
26 content_element.attrib["xml:lang"] = "en"
27- content_tree = ET.parse(io.StringIO(f"<div xmlns=\"http://www.w3.org/1999/xhtml\">{content}</div>")).getroot()
28+ content_tree = ET.parse(io.StringIO(f"<div>{content}</div>")).getroot()
29+ content_tree.attrib["xmlns"] = "http://www.w3.org/1999/xhtml"
30 content_element.append(content_tree)
31- updated = ET.SubElement(atom_entry, "updated")
32- updated.text = entry["date"].isoformat()
33
34
35 xml_str = ET.tostring(feed, xml_declaration=True, encoding="unicode", method="xml")