From ddfec773bd4eebb7af62b7410bcd1bac07d507ff Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Mon, 2 Nov 2020 14:28:35 +0100 Subject: [PATCH] Added a book look&feel, import template --- Shakefile.hs | 5 ++++- engine/dev.sh | 4 ++-- src/css/y.css | 42 +++++++++++++++++++++++++++++++++++++++ templates/header.mustache | 24 ++++++++++++++++++++++ templates/main.mustache | 32 ++--------------------------- templates/menu.mustache | 10 ++++++++++ templates/post.mustache | 32 ++--------------------------- templates/slide.mustache | 33 +++--------------------------- 8 files changed, 89 insertions(+), 93 deletions(-) create mode 100644 templates/header.mustache create mode 100644 templates/menu.mustache diff --git a/Shakefile.hs b/Shakefile.hs index ef337df..542bfaf 100644 --- a/Shakefile.hs +++ b/Shakefile.hs @@ -430,7 +430,10 @@ cleanRule = mkGetTemplate :: Rules (FilePath -> Action Template) mkGetTemplate = newCache $ \path -> do fileContent <- readFile' path - let res = compileMustacheText "page" (toS fileContent) + header <- readFile' ("templates" "header.mustache") + menu <- readFile' ("templates" "menu.mustache") + let withIncludes = fileContent & toS & T.replace "{{>header}}" (toS header) & T.replace "{{>menu}}" (toS menu) + res = compileMustacheText "page" (toS withIncludes) case res of Left _ -> fail "BAD" Right template -> return template diff --git a/engine/dev.sh b/engine/dev.sh index 3f18bbe..d4bf078 100755 --- a/engine/dev.sh +++ b/engine/dev.sh @@ -1,8 +1,8 @@ #!/usr/bin/env zsh cd "$(git rev-parse --show-toplevel)" || exit 1 -echo "Watching $PWD/src" +echo "Watching $PWD/{src,templates}" # fswatch --exclude='\\.#' src | while read event; do -fswatch --exclude='^.*\.#.*$' src | while read event; do +fswatch --exclude='^.*\.#.*$' src templates | while read event; do echo "$event" ./engine/build.sh fast done diff --git a/src/css/y.css b/src/css/y.css index 9c4999f..3584234 100644 --- a/src/css/y.css +++ b/src/css/y.css @@ -204,6 +204,48 @@ input#g:checked ~ div pre { em,strong,b,i,h1,h2,h3,h4,h5,h6 { color: var(--rfg); } +/* plain checked */ +input#b:checked ~ div { + --y: #b58900; + --o: #cb4b16; + --r: #dc322f; + --m: #d33682; + --v: #6c71c4; + --b: #268bd2; + --c: #2aa198; + --g: #859900; + --b03: #002b36; + --b02: #073642; + --b01: #586e75; + --b00: #657b83; + --b0: #839496; + --b1: #93a1a1; + --b2: #eee8d5; + --b3: #fdf6e3; + --hl: var(--y); + --bg: var(--b3); + --rbg: var(--b2); + --fg: var(--b00); + --fg0: var(--b1); + --rfg: var(--b01); + font-family: Hoefler Text, serif; + font-size: 21px; + line-height: 1.35em; +} +input#b:checked ~ div #content { + overflow: visible; +} +input#b:checked ~ div img { + border: solid 1px; + filter: brightness(0.8) sepia(30%) saturate(0.8); +} +input#b:checked ~ div pre { + background: var(--bg); + border-color: var(--rbg); +} + +em,strong,b,i,h1,h2,h3,h4,h5,h6 { color: var(--rfg); } + /* ---- */ ::selection { background: var(--m); diff --git a/templates/header.mustache b/templates/header.mustache new file mode 100644 index 0000000..242b746 --- /dev/null +++ b/templates/header.mustache @@ -0,0 +1,24 @@ + + + + +
+
+   + /  +   +   +   + /  + +
+
diff --git a/templates/main.mustache b/templates/main.mustache index 055c945..1ca6409 100644 --- a/templates/main.mustache +++ b/templates/main.mustache @@ -12,26 +12,7 @@ - - - -
-
-   -   -   - /  -
-
+ {{>header}}

{{title}}

@@ -41,16 +22,7 @@
- + {{>menu}}
diff --git a/templates/menu.mustache b/templates/menu.mustache new file mode 100644 index 0000000..3081d39 --- /dev/null +++ b/templates/menu.mustache @@ -0,0 +1,10 @@ + diff --git a/templates/post.mustache b/templates/post.mustache index de2f144..b049d98 100644 --- a/templates/post.mustache +++ b/templates/post.mustache @@ -10,26 +10,7 @@ - - - -
-
-   -   -   - /  -
-
+ {{>header}}
@@ -53,16 +34,7 @@
- + {{>menu}}
diff --git a/templates/slide.mustache b/templates/slide.mustache index 2094091..2f7431c 100644 --- a/templates/slide.mustache +++ b/templates/slide.mustache @@ -10,26 +10,8 @@ - - - -
-
-   -   -   - /  -
-
+ + {{>header}}
@@ -53,16 +35,7 @@
- + {{>menu}}