From cb42d99c43e70abeb812fab6af52c8b6b6929329 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 12 Jul 2020 18:19:18 -0400 Subject: [PATCH] start html templates --- Cargo.lock | 50 ++++++++++++++--------- Cargo.toml | 7 +++- css/shim.css | 20 ++++++++++ src/build.rs | 5 +++ static/js/installsw.js | 7 ++++ templates/footer.rs.html | 14 +++++++ templates/header.rs.html | 51 ++++++++++++++++++++++++ templates/index.rs.html | 85 ++++++++++++++++++++++++++++++++++++++++ 8 files changed, 219 insertions(+), 20 deletions(-) create mode 100644 css/shim.css create mode 100644 src/build.rs create mode 100644 static/js/installsw.js create mode 100644 templates/footer.rs.html create mode 100644 templates/header.rs.html create mode 100644 templates/index.rs.html diff --git a/Cargo.lock b/Cargo.lock index 61523b3..064310b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -154,6 +154,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" +[[package]] +name = "bytecount" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0017894339f586ccb943b01b9555de56770c11cda818e7e3d8bd93f4ed7f46e" + [[package]] name = "byteorder" version = "1.3.4" @@ -543,20 +549,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" -[[package]] -name = "handlebars" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8ae96a0e0dacf151557ccba95a7a80889f8e74a784484377739628fcdb3996" -dependencies = [ - "log 0.4.8", - "pest", - "pest_derive", - "quick-error", - "serde", - "serde_json", -] - [[package]] name = "headers" version = "0.3.2" @@ -808,6 +800,12 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +[[package]] +name = "md5" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" + [[package]] name = "memchr" version = "2.3.3" @@ -1435,6 +1433,20 @@ dependencies = [ "winreg", ] +[[package]] +name = "ructe" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f615d1e172dcc01a7cd78c7f77f21a5669c6de4341548ad2e7764e9045d06657" +dependencies = [ + "base64 0.12.3", + "bytecount", + "itertools", + "md5", + "mime 0.3.16", + "nom", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1660,9 +1672,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" +checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b" dependencies = [ "proc-macro2", "quote", @@ -2174,10 +2186,10 @@ dependencies = [ "anyhow", "comrak", "envy", - "handlebars", - "log 0.3.9", + "log 0.4.8", "pretty_env_logger", - "rand 0.6.5", + "rand 0.7.3", + "ructe", "serde", "serde_dhall", "tokio", diff --git a/Cargo.toml b/Cargo.toml index a17dc2c..d970e06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "xesite" version = "2.0.0" authors = ["Christine Dodrill "] edition = "2018" +build = "src/build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -10,11 +11,15 @@ edition = "2018" anyhow = "1" comrak = "0.7" envy = "0.4" -handlebars = "3.2.1" log = "0" pretty_env_logger = "0" rand = "0" +ructe = "0.11" serde_dhall = "0.5.3" serde = { version = "1", features = ["derive"] } tokio = { version = "0.2", features = ["macros"] } warp = "0.2" + +[build-dependencies] +ructe = { version = "0.11", features = ["warp02"] } + diff --git a/css/shim.css b/css/shim.css new file mode 100644 index 0000000..6cca7ab --- /dev/null +++ b/css/shim.css @@ -0,0 +1,20 @@ +.main { + padding: 20px 10px; +} + +.hack h1 { + padding-top: 0; +} + +footer.footer { + border-top: 1px solid #ccc; + margin-top: 80px; + margin-top: 5rem; + padding: 48px 0; + padding: 3rem 0; +} + +img { + max-width: 100%; + padding: 1em; +} diff --git a/src/build.rs b/src/build.rs new file mode 100644 index 0000000..9a6d3c3 --- /dev/null +++ b/src/build.rs @@ -0,0 +1,5 @@ +use ructe::{Result, Ructe}; + +fn main() -> Result<()> { + Ructe::from_env()?.compile_templates("templates") +} diff --git a/static/js/installsw.js b/static/js/installsw.js new file mode 100644 index 0000000..76c43f9 --- /dev/null +++ b/static/js/installsw.js @@ -0,0 +1,7 @@ +if (navigator.serviceWorker.controller) { + console.log("Active service worker found, no need to register"); +} else { + navigator.serviceWorker.register("/sw.js").then(function(reg) { + console.log("Service worker has been registered for scope:" + reg.scope); + }); +} diff --git a/templates/footer.rs.html b/templates/footer.rs.html new file mode 100644 index 0000000..c1fb2ee --- /dev/null +++ b/templates/footer.rs.html @@ -0,0 +1,14 @@ +@() +
+
Copyright 2020 Christine Dodrill. Any and all opinions listed here are my own and not representative of my employers; future, past and present.
+
+ +

Looking for someone for your team? Take a look here.

+
+ + + + + + + diff --git a/templates/header.rs.html b/templates/header.rs.html new file mode 100644 index 0000000..0f627c3 --- /dev/null +++ b/templates/header.rs.html @@ -0,0 +1,51 @@ +@(title: Option<&str>, styles: Option<&str>) + + + + + @if title.is_some() { + @title.unwrap() - Christine Dodrill + } else { + Christine Dodrill + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @if styles.is_some() { + + } + + +
+
+

Christine Dodrill - Blog - Contact - Gallery - Resume - Talks - Signal Boost - Feeds | GraphViz - When Then Zen

+
+ +
diff --git a/templates/index.rs.html b/templates/index.rs.html new file mode 100644 index 0000000..dce5fcf --- /dev/null +++ b/templates/index.rs.html @@ -0,0 +1,85 @@ +@() + + + + + + + + + + + + + + + + + + + + + +
+
+ My Avatar +
+ Contact Me +
+
+

Christine Dodrill

+

Full-stack Engineer

+
Skills
+
    +
  • Go, Lua, Nim, Haskell, C, Rust and other languages
  • +
  • Docker (deployment, development & more)
  • +
  • Mashups of data
  • +
  • Package maintainer for Adélie Linux
  • +
+ +
Highlighted Projects
+
    +
  • Aura - PonyvilleFM live DJ recording bot
  • +
  • Elemental-IRCd - IRC Server Software
  • +
  • This website - The backend and templates for this website
  • +
  • Olin - WebAssembly on the server
  • +
  • when-then-zen - Meditation instructions in Gherkin
  • +
  • Creator's Code - Minimal code of conduct for communities
  • +
  • printerfacts - Informative facts about printers
  • +
  • x - Experiments and toys
  • +
  • PonyAPI - My Little Pony: Friendship is Magic Episode information API
  • +
  • bsnk - Battlesnake bots
  • +
  • XeOS - An experimental microkernel in Rust
  • +
  • h - A satirical programming language
  • +
  • gruvbox-css - My minimal Gruvbox CSS theme
  • +
  • quickserv - A quick HTTP fileserver
  • +
+ +
Quick Links
+ + +

Looking for someone for your team? Check here. +

+