From 4045b97eeec04a5403ab5572841f5f12fd062dd2 Mon Sep 17 00:00:00 2001 From: valkyrie_pilot Date: Sun, 31 Mar 2024 06:23:37 -0600 Subject: [PATCH] Fix title whitespace --- src/main.rs | 7 +-- templates/index.hbs | 136 ++++++++++++++++++++++---------------------- 2 files changed, 69 insertions(+), 74 deletions(-) diff --git a/src/main.rs b/src/main.rs index 21d024d..169225f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,12 +61,7 @@ async fn svc(tcp: TcpListener, app: Router) { } #[derive(Template)] -#[template( - path = "index.hbs", - escape = "html", - whitespace = "suppress", - ext = "html" -)] +#[template(path = "index.hbs", escape = "html", ext = "html")] pub struct IndexPage { root_dns_name: Arc, ip: IpAddr, diff --git a/templates/index.hbs b/templates/index.hbs index e7a8b3c..e019a6b 100644 --- a/templates/index.hbs +++ b/templates/index.hbs @@ -1,80 +1,80 @@ -{% set scheme %} -{% if https %} -{% let scheme = "https" %} -{% else %} -{% let scheme = "http" %} -{% endif %} -{% let description = "A simple, fast website to return your IPv4 and IPv6 addresses. No logs are kept. Free and open to all." %} +{%- set scheme -%} +{%- if https -%} + {%- let scheme = "https" -%} +{%- else -%} + {%- let scheme = "http" -%} +{%- endif -%} +{%- let description = "A simple, fast website to return your IPv4 and IPv6 addresses. No logs are kept. Free and open to all." -%} - - + + - {% match ip %} - {% when IpAddr::V4 with (_) %} - - {% when IpAddr::V6 with (_) %} - - {% endmatch %} - - + {%- match ip -%} + {%- when IpAddr::V4 with (_) -%} + + {%- when IpAddr::V6 with (_) -%} + + {%- endmatch -%} + + - - - - - - - {% match ip %} - {% when IpAddr::V4 with (ipv4) %} - Your public IP is {{ ipv4 }} - {% when IpAddr::V6 with (_) %} - What's my IP? - {% endmatch %} + + + + + + + {%- match ip -%} + {%- when IpAddr::V4 with (ipv4) -%} + Your public IP is {{ ipv4 }} + {%- when IpAddr::V6 with (_) -%} + What's my IP? + {%- endmatch -%} - + - -
- {% match ip %} - {% when IpAddr::V4 with (ipv4) %} -
- Your public IPv4 is: {{ ipv4 }} -
- - {% when IpAddr::V6 with (ipv6) %} - -
- Your public IPv6 is: {{ ipv6 }} + +
+ {%- match ip -%} + {%- when IpAddr::V4 with (ipv4) -%} +
+ Your public IPv4 is: {{ ipv4 }} +
+ + {%- when IpAddr::V6 with (ipv6) -%} + +
+ Your public IPv6 is: {{ ipv6 }} +
+ {%- endmatch -%}
- {% endmatch %} -
- +