mirror of
https://git.sr.ht/~adnano/kiln
synced 2024-10-30 01:13:08 +00:00
Make templates use .tera extension
This commit is contained in:
parent
4f877bcffe
commit
ff5f6ddaf2
26
Cargo.lock
generated
26
Cargo.lock
generated
|
@ -207,13 +207,13 @@ dependencies = [
|
||||||
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"logger 0.1.0",
|
|
||||||
"pulldown-cmark 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pulldown-cmark 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rsass 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rsass 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tera 1.0.0-beta.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"simple-log 0.1.0 (git+https://git.sr.ht/~adnano/simple-log)",
|
||||||
|
"tera 1.0.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -235,14 +235,6 @@ dependencies = [
|
||||||
"cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "logger"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "maplit"
|
name = "maplit"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
|
@ -557,6 +549,15 @@ dependencies = [
|
||||||
"fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "simple-log"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://git.sr.ht/~adnano/simple-log#e037111566afd3ece75ba5690d66ff5a244c31ae"
|
||||||
|
dependencies = [
|
||||||
|
"env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slug"
|
name = "slug"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
|
@ -582,7 +583,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tera"
|
name = "tera"
|
||||||
version = "1.0.0-beta.5"
|
version = "1.0.0-beta.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -894,10 +895,11 @@ dependencies = [
|
||||||
"checksum serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "58fc82bec244f168b23d1963b45c8bf5726e9a15a9d146a067f9081aeed2de79"
|
"checksum serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "58fc82bec244f168b23d1963b45c8bf5726e9a15a9d146a067f9081aeed2de79"
|
||||||
"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d"
|
"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d"
|
||||||
"checksum sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded"
|
"checksum sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded"
|
||||||
|
"checksum simple-log 0.1.0 (git+https://git.sr.ht/~adnano/simple-log)" = "<none>"
|
||||||
"checksum slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373"
|
"checksum slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373"
|
||||||
"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be"
|
"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be"
|
||||||
"checksum syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)" = "66c8865bf5a7cbb662d8b011950060b3c8743dca141b054bf7195b20d314d8e2"
|
"checksum syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)" = "66c8865bf5a7cbb662d8b011950060b3c8743dca141b054bf7195b20d314d8e2"
|
||||||
"checksum tera 1.0.0-beta.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ee2a86432150f195cc337f91f70cf9b507d83f538fc9bb156ca85acc119a5445"
|
"checksum tera 1.0.0-beta.6 (registry+https://github.com/rust-lang/crates.io-index)" = "603de2ef6fe7bc1989ea4457b5b1e36d5f6dda8fc84ee6f0362229d3f09084fb"
|
||||||
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
|
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
|
||||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||||
|
|
|
@ -15,6 +15,6 @@ regex = "1.1"
|
||||||
rsass = "0.9"
|
rsass = "0.9"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
tera = "1.0.0-beta.5"
|
tera = "1.0.0-beta.6"
|
||||||
toml = "0.4"
|
toml = "0.4"
|
||||||
logger = { path = "../logger" }
|
simple-log = { version = "0.1.0", git = "https://git.sr.ht/~adnano/simple-log" }
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
|
use std::io::Result;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::{env, fs, ops, slice};
|
use std::{env, fs, ops, slice};
|
||||||
|
|
||||||
use std::io::Result;
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Index(Vec<(PathBuf, Vec<u8>)>);
|
pub struct Index(Vec<(PathBuf, Vec<u8>)>);
|
||||||
|
|
||||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -1,5 +1,7 @@
|
||||||
fn main() -> kiln::Exit {
|
#[macro_use]
|
||||||
logger::new().init();
|
extern crate log;
|
||||||
kiln::run()?;
|
|
||||||
Ok(())
|
fn main() {
|
||||||
|
simple_log::init();
|
||||||
|
kiln::run().unwrap_or_else(|e| error!("{}", e));
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,8 @@ impl<'a> Manipulater<'a> {
|
||||||
fn manipulate(mut self) -> Result<()> {
|
fn manipulate(mut self) -> Result<()> {
|
||||||
for (i, (path, contents)) in self.index.iter_mut().enumerate() {
|
for (i, (path, contents)) in self.index.iter_mut().enumerate() {
|
||||||
match path.extension().and_then(OsStr::to_str) {
|
match path.extension().and_then(OsStr::to_str) {
|
||||||
Some("html") => {
|
Some("tera") => {
|
||||||
|
path.set_extension("html");
|
||||||
let filename = path.file_name().unwrap();
|
let filename = path.file_name().unwrap();
|
||||||
if filename == "index.html" {
|
if filename == "index.html" {
|
||||||
path.pop();
|
path.pop();
|
||||||
|
|
Loading…
Reference in a new issue