diff --git a/Cargo.lock b/Cargo.lock index 4c4c504..bdd7cbc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -139,6 +139,54 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "askama" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb98f10f371286b177db5eeb9a6e5396609555686a35e1d4f7b9a9c6d8af0139" +dependencies = [ + "askama_derive", + "askama_escape", + "askama_shared", +] + +[[package]] +name = "askama_derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87bf87e6e8b47264efa9bde63d6225c6276a52e05e91bf37eaa8afd0032d6b71" +dependencies = [ + "askama_shared", + "proc-macro2", + "syn", +] + +[[package]] +name = "askama_escape" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" + +[[package]] +name = "askama_shared" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf722b94118a07fcbc6640190f247334027685d4e218b794dbfe17c32bf38ed0" +dependencies = [ + "askama_escape", + "humansize", + "mime", + "mime_guess", + "nom 7.1.1", + "num-traits", + "percent-encoding", + "proc-macro2", + "quote", + "serde", + "syn", + "toml", +] + [[package]] name = "async-attributes" version = "1.1.2" @@ -1333,6 +1381,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "humansize" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02296996cb8796d7c6e3bc2d9211b7802812d36999a51bb754123ead7d37d026" + [[package]] name = "iana-time-zone" version = "0.1.50" @@ -2988,6 +3042,7 @@ dependencies = [ name = "tildes-statistics" version = "0.1.0" dependencies = [ + "askama", "async-std", "chrono", "clap 4.0.10", @@ -3094,6 +3149,15 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "toml" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +dependencies = [ + "serde", +] + [[package]] name = "tracing" version = "0.1.36" diff --git a/Cargo.toml b/Cargo.toml index cf74dce..07f6787 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ name = "tildes-statistics" path = "source/main.rs" [dependencies] +askama = "0.11.1" async-std = "1.12.0" chrono = "0.4.22" color-eyre = "0.6.2" diff --git a/askama.toml b/askama.toml new file mode 100644 index 0000000..fcc0ab4 --- /dev/null +++ b/askama.toml @@ -0,0 +1,2 @@ +[general] +dirs = ["source/templates"] diff --git a/source/main.rs b/source/main.rs index cb6f5d1..5d9b167 100644 --- a/source/main.rs +++ b/source/main.rs @@ -15,6 +15,7 @@ pub mod cli; pub mod group_data; pub mod migrations; pub mod snapshots; +pub mod templates; pub mod utilities; /// The entities code is auto-generated using `sea-orm-cli`. With a database diff --git a/source/templates/base.html b/source/templates/base.html new file mode 100644 index 0000000..9fc0056 --- /dev/null +++ b/source/templates/base.html @@ -0,0 +1,17 @@ + + + +
+ + + +