diff options
| author | Xe Iaso <me@christine.website> | 2022-09-20 21:05:44 -0400 |
|---|---|---|
| committer | Xe Iaso <me@christine.website> | 2022-09-20 21:05:44 -0400 |
| commit | 67005bc59dd918eadcbd9c7c9285aed0c3422292 (patch) | |
| tree | de54bbad6aa651d4e56517af56a6773f02766fcf /lib/xesite_templates/src | |
| parent | 839c44e535d03f8ae747139acd27109e897c76e4 (diff) | |
| download | xesite-67005bc59dd918eadcbd9c7c9285aed0c3422292.tar.xz xesite-67005bc59dd918eadcbd9c7c9285aed0c3422292.zip | |
move markdown and templates into a dedicated crate
This does not move the ructe templates around, only the newer Maud ones.
The only template I can't move easily is the salary history one, but I
should get rid of that anyways.
Diffstat (limited to 'lib/xesite_templates/src')
| -rw-r--r-- | lib/xesite_templates/src/lib.rs | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/lib/xesite_templates/src/lib.rs b/lib/xesite_templates/src/lib.rs new file mode 100644 index 0000000..0a8ff1d --- /dev/null +++ b/lib/xesite_templates/src/lib.rs @@ -0,0 +1,91 @@ +use maud::{html, Markup}; + +pub fn talk_warning() -> Markup { + html! { + div.warning { + (conv("Cadey".to_string(), "coffee".to_string(), html!{ + "So you are aware: you are reading the written version of a conference talk. This is written in a different style that is more lighthearted, conversational and different than the content normally on this blog. The words being said are the verbatim words that were spoken at the conference. The slides are the literal slides for each spoken utterance. If you want to hide the non-essential slides, please install this userstyle: " + a href="/css/no-fun-allowed.user.css" {code {"No fun allowed"}} + ". If this isn't enough, please edit it to also hide this CSS class: " + code { "xeblog-slides-essential" } + ". Doing this may make the presentation page harder to understand." + })) + } + } +} + +pub fn slide(name: String, essential: bool) -> Markup { + html! { + div.hero.{@if essential {("xeblog-slides-essential")} @else {("xeblog-slides-fluff")}} { + picture style="margin:0" { + source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/talks/" (name) ".avif"}; + source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/talks/" (name) ".webp"}; + img style="padding:0" loading="lazy" src={"https://cdn.xeiaso.net/file/christine-static/talks/" (name) "-smol.png"}; + } + } + } +} + +pub fn picture(path: String) -> Markup { + html! { + picture style="margin:0" { + source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/" (path) ".avif"}; + source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/" (path) ".webp"}; + img style="padding:0" loading="lazy" alt={"hero image " (path)} src={"https://cdn.xeiaso.net/file/christine-static/" (path) "-smol.png"}; + } + } +} + +pub fn hero(file: String, prompt: Option<String>, ai: Option<String>) -> Markup { + let ai = ai.unwrap_or("MidJourney".to_string()); + html! { + meta property="og:image" content={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) "-smol.png"} + figure.hero style="margin:0" { + picture style="margin:0" { + source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) ".avif"}; + source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) ".webp"}; + img style="padding:0" loading="lazy" alt={"hero image " (file)} src={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) "-smol.png"}; + } + figcaption { + "Image generated by " + (ai) + @if let Some(prompt) = prompt { " -- " (prompt) } + } + } + } +} + +pub fn conv(name: String, mood: String, body: Markup) -> Markup { + let name_lower = name.clone().to_lowercase(); + + html! { + .conversation { + ."conversation-picture"."conversation-smol" { + picture { + source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".avif"}; + source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".webp"}; + img alt={(name) " is " (mood)} loading="lazy" src={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".png"}; + } + } + ."conversation-chat" { + "<" + b { (name) } + "> " + (body) + } + } + } +} + +pub fn sticker(name: String, mood: String) -> Markup { + let name_lower = name.to_lowercase(); + html! { + center { + picture { + source type="image/avif" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".avif"}; + source type="image/webp" srcset={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".webp"}; + img alt={(name) " is " (mood)} src={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".png"}; + } + } + } +} |
