diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -37,10 +37,8 @@ async fn fetch(req: Request, env: Env, _ctx: Context) -> Result<Response> { " 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<Response> { " " (t) } } - (PreEscaped("<pre>")) + (PreEscaped("<pre class=\"d\">")) } - }) - }) { - (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" + } + } } } }) |
