diff --git a/mbox2web b/mbox2web index 2ae0e81..75cd54e 100755 --- a/mbox2web +++ b/mbox2web @@ -87,10 +87,18 @@ def render_body(msg): elif content_type == "text/html": htmlpart = HTMLPart() htmlpart.feed(msg.get_payload()) - bodyhtml = htmlpart.as_string() + bodytmpl = jenv.get_template("body_text_html.html") + context = { + "body": jinja2.Markup(htmlpart.as_string()) + } + bodyhtml = bodytmpl.render(context) elif content_type == "text/enriched": tepart = TextEnrichedPart(msg.get_payload()) - bodyhtml = tepart.as_string() + bodytmpl = jenv.get_template("body_text_enriched.html") + context = { + "body": jinja2.Markup(tepart.as_string()) + } + bodyhtml = bodytmpl.render(context) elif content_type == "message/partial": # Default header for get_param is Content-Type whole_msg_id = msg.get_param("id") diff --git a/templates/body_message_rfc822.html b/templates/body_message_rfc822.html new file mode 100644 index 0000000..4abc835 --- /dev/null +++ b/templates/body_message_rfc822.html @@ -0,0 +1,18 @@ +
+
+ message/rfc822 +
+
+ + + + + +
Message-Id {{message_id}}
Subject {{subject}}
From {{from}}
Date {{date}}
+ + {% for p in parts %} + {{p}} + {% endfor %} + +
+
diff --git a/templates/body_multipart_digest.html b/templates/body_multipart_digest.html new file mode 100644 index 0000000..ebcb60f --- /dev/null +++ b/templates/body_multipart_digest.html @@ -0,0 +1,10 @@ +
+
+ multipart/digest +
+
+ {% for part in parts %} + {{part}} + {% endfor %} +
+
diff --git a/templates/body_multipart_mixed.html b/templates/body_multipart_mixed.html new file mode 100644 index 0000000..221ca00 --- /dev/null +++ b/templates/body_multipart_mixed.html @@ -0,0 +1,10 @@ +
+
+ multipart/mixed +
+
+ {% for part in parts %} + {{part}} + {% endfor %} +
+
diff --git a/templates/body_text_enriched.html b/templates/body_text_enriched.html new file mode 100644 index 0000000..30ea197 --- /dev/null +++ b/templates/body_text_enriched.html @@ -0,0 +1,8 @@ +
+
+ text/enriched +
+
+ {{body}} +
+
diff --git a/templates/body_text_html.html b/templates/body_text_html.html new file mode 100644 index 0000000..a42fbb4 --- /dev/null +++ b/templates/body_text_html.html @@ -0,0 +1,8 @@ +
+
+ text/html +
+
+ {{body}} +
+
diff --git a/templates/body_text_plain.html b/templates/body_text_plain.html new file mode 100644 index 0000000..e86e5c4 --- /dev/null +++ b/templates/body_text_plain.html @@ -0,0 +1,10 @@ +
+
+ text/plain +
+
+
+{{body}}
+
+
+
diff --git a/templates/message.html b/templates/message.html new file mode 100644 index 0000000..aa3ab6d --- /dev/null +++ b/templates/message.html @@ -0,0 +1,21 @@ + + + + + + {{list}}: {{subject}} + + + + +

{{subject}}

+ + + + +
Message-Id {{message_id}}
From {{from}}
Date {{date}}
+ + {{bodyhtml}} + + + diff --git a/templates/message2.html b/templates/message2.html new file mode 100644 index 0000000..4c89f26 --- /dev/null +++ b/templates/message2.html @@ -0,0 +1,16 @@ +
+
+ message +
+
+ + + + + +
Message-Id {{message_id}}
Subject {{subject}}
From {{from}}
Date {{date}}
+ + {{bodyhtml}} + +
+