mirror of
https://github.com/Noratrieb/website.git
synced 2026-01-14 08:55:01 +01:00
update
This commit is contained in:
parent
1e1f0be7ac
commit
a041618a73
9 changed files with 256 additions and 281 deletions
|
|
@ -3,34 +3,21 @@
|
|||
use std::path::Path;
|
||||
|
||||
use color_eyre::{eyre::WrapErr, Result};
|
||||
use rand::seq::SliceRandom;
|
||||
|
||||
use crate::{utils, SlidesConfig};
|
||||
|
||||
pub fn build(
|
||||
rng: &mut rand::rngs::StdRng,
|
||||
_rng: &mut rand::rngs::StdRng,
|
||||
config: &SlidesConfig,
|
||||
statics: &Path,
|
||||
dist: &Path,
|
||||
) -> Result<()> {
|
||||
let back_alley_name = b"abcdefghijklmnopqrstuvwxyz"
|
||||
.choose_multiple(rng, 6)
|
||||
.map(|&c| char::from_u32(c.into()).unwrap())
|
||||
.collect::<String>();
|
||||
|
||||
let back_alley_name = format!("back-alley-{back_alley_name}.html");
|
||||
|
||||
let mut context = tera::Context::new();
|
||||
|
||||
context.insert("back_alley_name", back_alley_name.as_str());
|
||||
context.insert("talks", &config.talks);
|
||||
|
||||
utils::copy_fn(&statics.join("root"), dist, |content, ext, opts| {
|
||||
utils::copy_fn(&statics.join("root"), dist, |content, ext, _opts| {
|
||||
if ext.is_some_and(|ext| matches!(ext, "html" | "css")) {
|
||||
if opts.dest_path.ends_with("back-alley.html") {
|
||||
opts.dest_path.set_file_name(&back_alley_name);
|
||||
}
|
||||
|
||||
let content = String::from_utf8(content).wrap_err("HTML or CSS is invalid UTF-8")?;
|
||||
let mut tera = tera::Tera::default();
|
||||
tera.add_raw_template("template", &content)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue