feat: Initial commit for krile

master
ana 1 year ago
parent 43e141b2ad
commit c1c7294c16
  1. 192
      Cargo.lock
  2. 3
      Cargo.toml
  3. 1
      krile/CHANGELOG.md
  4. 12
      krile/Cargo.toml
  5. 54
      krile/src/main.rs

192
Cargo.lock generated

@ -20,6 +20,35 @@ dependencies = [
"winapi",
]
[[package]]
name = "argh"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e7317a549bc17c5278d9e72bb6e62c6aa801ac2567048e39ebc1c194249323e"
dependencies = [
"argh_derive",
"argh_shared",
]
[[package]]
name = "argh_derive"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60949c42375351e9442e354434b0cba2ac402c1237edf673cac3a4bf983b8d3c"
dependencies = [
"argh_shared",
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "argh_shared"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a61eb019cb8f415d162cb9f12130ee6bbe9168b7d953c17f4ad049e4051ca00"
[[package]]
name = "atty"
version = "0.2.13"
@ -78,6 +107,12 @@ dependencies = [
"memchr",
]
[[package]]
name = "bumpalo"
version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631"
[[package]]
name = "byte-tools"
version = "0.3.1"
@ -262,6 +297,15 @@ dependencies = [
"walkdir",
]
[[package]]
name = "heck"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "humansize"
version = "1.1.1"
@ -321,6 +365,24 @@ version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
[[package]]
name = "js-sys"
version = "0.3.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "krile"
version = "0.0.1"
dependencies = [
"argh",
"minifemme",
"shtola 0.3.0-alpha1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -360,6 +422,22 @@ version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
[[package]]
name = "minifemme"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be021794bb7965e43d1d41868cd875ac9002693a6335b83de33b88c979ed0b88"
dependencies = [
"cfg-if 0.1.10",
"js-sys",
"log",
"serde",
"serde_derive",
"serde_json",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "num-integer"
version = "0.1.41"
@ -474,9 +552,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.6"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
dependencies = [
"unicode-xid",
]
@ -605,11 +683,22 @@ version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4b39bd9b0b087684013a792c59e3e07a46a01d2322518d8a1104641a0b1be0"
[[package]]
name = "serde_derive"
version = "1.0.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_json"
version = "1.0.41"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2"
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
dependencies = [
"itoa",
"ryu",
@ -658,6 +747,25 @@ dependencies = [
"ware 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "shtola"
version = "0.3.0-alpha1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a524300f156cfbc3051d5163645d3ef2fcb447c45f386fabc784e2f9342ac09"
dependencies = [
"comrak",
"globset",
"id_tree",
"im",
"log",
"pathdiff",
"serde_json",
"serde_yaml",
"tera",
"walkdir",
"ware 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "sized-chunks"
version = "0.3.1"
@ -690,9 +798,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "syn"
version = "1.0.8"
version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "661641ea2aa15845cddeb97dad000d22070bb5c1fb456b96c1cba883ec691e92"
checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7"
dependencies = [
"proc-macro2",
"quote",
@ -852,6 +960,12 @@ dependencies = [
"unic-common",
]
[[package]]
name = "unicode-segmentation"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
[[package]]
name = "unicode-width"
version = "0.1.6"
@ -903,6 +1017,72 @@ version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "wasm-bindgen"
version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
dependencies = [
"cfg-if 1.0.0",
"serde",
"serde_json",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900"
dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f"
[[package]]
name = "web-sys"
version = "0.3.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.8"

@ -1,5 +1,6 @@
[workspace]
members = [
"ware",
"shtola"
"shtola",
"krile"
]

@ -0,0 +1 @@
# Changelog

@ -0,0 +1,12 @@
[package]
name = "krile"
description = "A static site generator"
version = "0.0.1"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
shtola = { version = "0.3.0-alpha1", features = ["full"] }
argh = "~0.1"
minifemme = "~1.0"

@ -0,0 +1,54 @@
use std::path::PathBuf;
use std::time::Instant;
use argh::FromArgs;
use shtola::log::*;
use shtola::plugins;
use shtola::Shtola;
#[derive(FromArgs)]
/// A static site generator.
struct Args {
/// the source directory
#[argh(positional)]
source: PathBuf,
/// the destination directory
#[argh(positional, default = "PathBuf::from(\"./dest\")")]
destination: PathBuf,
/// whether to wipe the destination directory before building
#[argh(switch, short = 'c')]
clean: bool,
/// whether to skip parsing frontmatter (will probably break plugins)
#[argh(switch, short = 'f')]
frontmatter: bool,
/// what plugins to not run
#[argh(option, short = 'i')]
ignored_plugins: Vec<String>,
}
fn main() {
minifemme::start(minifemme::LevelFilter::Info, minifemme::LogMode::Pretty);
info!("Starting build");
let start = Instant::now();
let args: Args = argh::from_env();
let mut sh = Shtola::new();
sh.source(args.source);
sh.destination(args.destination);
sh.clean(args.clean);
sh.frontmatter(!args.frontmatter);
if !args.ignored_plugins.contains(&"tera_layouts".to_string()) {
sh.register(plugins::tera_layouts::plugin());
}
if !args.ignored_plugins.contains(&"markdown".to_string()) {
sh.register(plugins::markdown::plugin());
}
sh.build().unwrap();
info!(
"Finished build in {:?}",
Instant::now().duration_since(start)
);
}
Loading…
Cancel
Save