aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2022-09-17 02:27:29 +0000
committerXe Iaso <me@christine.website>2022-09-17 02:27:39 +0000
commit839c44e535d03f8ae747139acd27109e897c76e4 (patch)
tree37fc4f812501463454a4f9aa41c9eef2ea430600 /src
parent812f4d5baabf0d53fb8cb9c821ea8b2e134fc320 (diff)
downloadxesite-839c44e535d03f8ae747139acd27109e897c76e4.tar.xz
xesite-839c44e535d03f8ae747139acd27109e897c76e4.zip
push 2fa considered harmful
Signed-off-by: Xe Iaso <me@christine.website>
Diffstat (limited to 'src')
-rw-r--r--src/app/markdown.rs5
-rw-r--r--src/tmpl/mod.rs10
2 files changed, 15 insertions, 0 deletions
diff --git a/src/app/markdown.rs b/src/app/markdown.rs
index 65d084d..9c3266e 100644
--- a/src/app/markdown.rs
+++ b/src/app/markdown.rs
@@ -98,6 +98,11 @@ pub fn render(cfg: Arc<Config>, inp: &str) -> Result<String> {
el.remove_and_keep_content();
Ok(())
}),
+ element!("xeblog-picture", |el| {
+ let path = el.get_attribute("path").expect("wanted xeblog-picture to contain path");
+ el.replace(&crate::tmpl::xeblog_picture(path).0, ContentType::Html);
+ Ok(())
+ }),
element!("xeblog-hero", |el| {
let file = el.get_attribute("file").expect("wanted xeblog-hero to contain file");
el.replace(&crate::tmpl::xeblog_hero(file, el.get_attribute("prompt"), el.get_attribute("ai")).0, ContentType::Html);
diff --git a/src/tmpl/mod.rs b/src/tmpl/mod.rs
index c0b1089..ec7ccd5 100644
--- a/src/tmpl/mod.rs
+++ b/src/tmpl/mod.rs
@@ -48,6 +48,16 @@ pub fn xeblog_slide(name: String, essential: bool) -> Markup {
}
}
+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! {