From 695f9dd642fcfd02134538013caab96268d3503e Mon Sep 17 00:00:00 2001 From: u <@> Date: Sun, 15 Mar 2026 18:31:20 +0200 Subject: yuck --- src/lib.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1ad7a38..012938e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,10 +37,8 @@ async fn fetch(req: Request, env: Env, _ctx: Context) -> Result { " dates." } pre { - @for x in a.split('\n').map(|l| { - dateparse(l) - .map_or_else(|| html! { (PreEscaped(l)) "\n" }, - |c| { + @let mut peek = a.split('\n').map(|l| { + (l, dateparse(l).map(|c| { let (m, d, y) = c; let y = y + 2000; let s = solar(y, m, d); @@ -56,11 +54,19 @@ async fn fetch(req: Request, env: Env, _ctx: Context) -> Result { " " (t) } } - (PreEscaped("
"))
+                                (PreEscaped("
"))
                             }
-                        })
-                    }) {
-                        (x)
+                        }))
+                    }).peekable();
+                    @while let Some((l, d)) = peek.next() {
+                        @if let Some(h) = d {
+                            (h)
+                        } @else {
+                            (PreEscaped(l))
+                            @if let Some((_, None)) = &peek.peek() {
+                                "\n"
+                            }
+                        }
                     }
                 }
             })
-- 
cgit v1.2.3