From df7fcb577777f50b224fe61343b77550d2c7d568 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sun, 10 Mar 2019 22:47:10 +0100 Subject: [PATCH] Handle message/news --- mbox2web | 11 +++++++++++ templates/message2.html | 1 + 2 files changed, 12 insertions(+) diff --git a/mbox2web b/mbox2web index d911c5c..7b7d7c1 100755 --- a/mbox2web +++ b/mbox2web @@ -40,6 +40,7 @@ def render_message(msg): msgtmpl = jenv.get_template("message2.html") bodyhtml = render_body(msg) context = { + "msg": msg, "message_id": msg["Message-Id"], "subject": msg["Subject"], "from": msg["From"], @@ -243,6 +244,16 @@ def render_body(msg): elif content_type == "application/x-gzip": bodyhtml = save_part(msg) + elif content_type == "message/news": + partshtml = [] + for part in msg.get_payload(): + partshtml.append(render_message(part)) + bodytmpl = jenv.get_template("body_message_news.html") + context = { + "msg": msg, + "parts": partshtml, + } + bodyhtml = bodytmpl.render(context) else: raise RuntimeError("Content-type " + content_type + " not implemented yet") diff --git a/templates/message2.html b/templates/message2.html index 4c89f26..1841987 100644 --- a/templates/message2.html +++ b/templates/message2.html @@ -4,6 +4,7 @@
+
Newsgroups {{msg.newsgroups}}
Message-Id {{message_id}}
Subject {{subject}}
From {{from}}