mirror of
https://github.com/Noratrieb/website.git
synced 2026-01-14 17:05:02 +01:00
STUFF
This commit is contained in:
parent
5f1f9bd6a6
commit
2da77e8af5
13 changed files with 314 additions and 33 deletions
|
|
@ -16,8 +16,8 @@ pub fn build(config: &SlidesConfig, slides: &Path, dist: &Path) -> Result<()> {
|
|||
utils::cp_r(&slides.join("plugin"), &dist.join("plugin")).wrap_err("copying reveal.js dist")?;
|
||||
|
||||
for talk in &config.talks {
|
||||
let path = slides.join(talk);
|
||||
let dist = dist.join(talk);
|
||||
let path = slides.join(talk.dirname());
|
||||
let dist = dist.join(talk.dirname());
|
||||
|
||||
utils::cp_r(&path, &dist).wrap_err("copying slide data")?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ use std::{fs, path::Path};
|
|||
use askama::Template;
|
||||
use color_eyre::{eyre::WrapErr, Result};
|
||||
|
||||
use crate::{utils, SlidesConfig};
|
||||
use crate::{utils, SlidesConfig, Talk};
|
||||
|
||||
#[derive(askama::Template)]
|
||||
#[template(path = "slides.html")]
|
||||
struct Slides {
|
||||
talks: Vec<String>,
|
||||
talks: Vec<Talk>,
|
||||
}
|
||||
|
||||
pub fn build(config: &SlidesConfig, statics: &Path, dist: &Path) -> Result<()> {
|
||||
|
|
|
|||
20
src/main.rs
20
src/main.rs
|
|
@ -29,7 +29,24 @@ struct Config {
|
|||
|
||||
#[derive(Deserialize)]
|
||||
struct SlidesConfig {
|
||||
talks: Vec<String>,
|
||||
talks: Vec<Talk>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone)]
|
||||
struct Talk {
|
||||
name: String,
|
||||
date: String,
|
||||
location: String,
|
||||
}
|
||||
|
||||
impl Talk {
|
||||
fn dirname(&self) -> String {
|
||||
format!(
|
||||
"{}-{}",
|
||||
self.date,
|
||||
self.name.replace(" ", "-").to_lowercase()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
|
|
@ -64,6 +81,7 @@ fn main() -> Result<()> {
|
|||
}
|
||||
|
||||
fn watch(root: &'static Path) -> Result<()> {
|
||||
build(root).wrap_err("initial build")?;
|
||||
let (send, recv) = std::sync::mpsc::sync_channel(1);
|
||||
let mut watcher = notify::recommended_watcher(move |res| match res {
|
||||
Ok(_) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue