commit c90e0d426db207011aa7843e4dd17931321fefc7
parent acfadda4fd8cbd83b593670036cdad920be31709
Author: alex wennerberg <alex@alexwennerberg.com>
Date: Sun, 27 Mar 2022 10:28:55 -0700
fix flowed
Diffstat:
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/TODO b/TODO
@@ -1,6 +1,6 @@
TODO
====
-atom feeds working -> pull last x into threads
+cleanup atom threads
paginate list home
only unformat flowed if we are format flowed in gmi, html, xml
URL encode spaces in links for gemini export
diff --git a/src/templates/gmi.rs b/src/templates/gmi.rs
@@ -84,6 +84,10 @@ impl Thread {
if msg.cc.len() > 0 {
optional_headers.push_str(&format!("\nCc: {}", cc_string));
}
+ let body = match msg.flowed {
+ true => unformat_flowed(&msg.body),
+ false => msg.body.clone(),
+ };
let msg = template(
r#"
## {subject}
@@ -115,7 +119,7 @@ To: {to}{optional_headers}
("msg_path", &h(msg.pathescape_msg_id().to_str().unwrap())),
// TODO escape # in body?
// TODO only unformat flowed if flowed is true
- ("body", &unformat_flowed(&msg.body)),
+ ("body", &body),
],
)
.unwrap();
diff --git a/src/templates/xml.rs b/src/templates/xml.rs
@@ -37,6 +37,10 @@ const MESSAGE_TEMPLATE: &str = r#"<entry>
impl StrMessage {
pub fn to_xml(&self) -> String {
let msg = self;
+ let body = match self.flowed {
+ true => unformat_flowed(&self.body),
+ false => self.body.clone(),
+ };
template(
MESSAGE_TEMPLATE,
&[
@@ -49,7 +53,7 @@ impl StrMessage {
&x(&msg.from.clone().name.unwrap_or(msg.from.clone().address)),
),
("author_email", &x(&msg.from.address)),
- ("content", &x(&unformat_flowed(&msg.body))),
+ ("content", &x(&body)),
],
)
.unwrap()