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 /src/tmpl | |
| 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 'src/tmpl')
| -rw-r--r-- | src/tmpl/mod.rs | 92 | ||||
| -rw-r--r-- | src/tmpl/nag.rs | 2 |
2 files changed, 2 insertions, 92 deletions
diff --git a/src/tmpl/mod.rs b/src/tmpl/mod.rs index ec7ccd5..b2ffd0d 100644 --- a/src/tmpl/mod.rs +++ b/src/tmpl/mod.rs @@ -4,7 +4,7 @@ use std::sync::Arc; pub mod nag; -pub fn xeblog_salary_history(cfg: Arc<Config>) -> Markup { +pub fn salary_history(cfg: Arc<Config>) -> Markup { html! { table.salary_history { tr { @@ -21,93 +21,3 @@ 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_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 xeblog_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 xeblog_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 xeblog_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"}; - } - } - } -} diff --git a/src/tmpl/nag.rs b/src/tmpl/nag.rs index a41447b..4ba165e 100644 --- a/src/tmpl/nag.rs +++ b/src/tmpl/nag.rs @@ -1,9 +1,9 @@ -use super::xeblog_conv; use crate::post::Post; use chrono::prelude::*; use lazy_static::lazy_static; use maud::{html, Markup}; use regex::Regex; +use xesite_templates::conv as xeblog_conv; lazy_static! { static ref HN: Regex = Regex::new(r#"^https?://news.ycombinator.com"#).unwrap(); |
