diff options
| author | Xe Iaso <me@christine.website> | 2022-09-12 12:26:33 +0000 |
|---|---|---|
| committer | Xe Iaso <me@christine.website> | 2022-09-12 12:26:57 +0000 |
| commit | 1dfabc42cebe4f4585e5a9930735ed276f61eff7 (patch) | |
| tree | 1e4ce420e33ca88e928068359a696ce2f5dbe9ac /src | |
| parent | ba28966de6d7de4b36cd3278e00a01432680b944 (diff) | |
| download | xesite-1dfabc42cebe4f4585e5a9930735ed276f61eff7.tar.xz xesite-1dfabc42cebe4f4585e5a9930735ed276f61eff7.zip | |
My website is fast
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/markdown.rs | 12 | ||||
| -rw-r--r-- | src/tmpl/mod.rs | 30 |
2 files changed, 39 insertions, 3 deletions
diff --git a/src/app/markdown.rs b/src/app/markdown.rs index e539234..65d084d 100644 --- a/src/app/markdown.rs +++ b/src/app/markdown.rs @@ -110,12 +110,22 @@ pub fn render(cfg: Arc<Config>, inp: &str) -> Result<String> { }), element!("xeblog-sticker", |el| { let name = el.get_attribute("name").expect("wanted xeblog-sticker to contain name"); - let name_lower = name.clone().to_lowercase(); let mood = el.get_attribute("mood").expect("wanted xeblog-sticker to contain mood"); el.replace(&crate::tmpl::xeblog_sticker(name, mood).0, ContentType::Html); Ok(()) }), + element!("xeblog-slide", |el| { + let name = el.get_attribute("name").expect("wanted xeblog-slide to contain name"); + let essential = el.get_attribute("essential").is_some(); + el.replace(&crate::tmpl::xeblog_slide(name, essential).0, ContentType::Html); + + Ok(()) + }), + element!("xeblog-talk-warning", |el| { + el.replace(&crate::tmpl::xeblog_talk_warning().0, ContentType::Html); + Ok(()) + }), ], ..RewriteStrSettings::default() }).unwrap(); diff --git a/src/tmpl/mod.rs b/src/tmpl/mod.rs index d919c92..c0b1089 100644 --- a/src/tmpl/mod.rs +++ b/src/tmpl/mod.rs @@ -22,6 +22,32 @@ pub fn xeblog_salary_history(cfg: Arc<Config>) -> Markup { } } +pub fn xeblog_talk_warning() -> Markup { + html! { + div.warning { + (xeblog_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 xeblog_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 xeblog_hero(file: String, prompt: Option<String>, ai: Option<String>) -> Markup { let ai = ai.unwrap_or("MidJourney".to_string()); html! { @@ -30,7 +56,7 @@ pub fn xeblog_hero(file: String, prompt: Option<String>, ai: Option<String>) -> 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" alt={"hero image " (file)} src={"https://cdn.xeiaso.net/file/christine-static/hero/" (file) "-smol.png"}; + 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 " @@ -50,7 +76,7 @@ pub fn xeblog_conv(name: String, mood: String, body: Markup) -> Markup { 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"}; + img alt={(name) " is " (mood)} loading="lazy" src={"https://cdn.xeiaso.net/file/christine-static/stickers/" (name_lower) "/" (mood) ".png"}; } } ."conversation-chat" { |
