From cb35d1b5811aac349fd4d09bc3c0d666bd7ebeae Mon Sep 17 00:00:00 2001
From: Nguyễn Gia Phong
Date: Fri, 31 Dec 2021 23:14:08 +0700
Subject: Improve dependency injection
---
.builds/auto.yml | 2 +-
.builds/shell.nix | 11 ++++---
README.md | 2 +-
_css/style.css | 12 +++++---
_layout/page_foot.html | 2 +-
_libs/formbox/comment.html | 3 +-
_libs/formbox/format | 76 ----------------------------------------------
_libs/minify | 42 -------------------------
_libs/postprocess | 42 +++++++++++++++++++++++++
utils.jl | 3 +-
10 files changed, 62 insertions(+), 133 deletions(-)
delete mode 100755 _libs/formbox/format
delete mode 100755 _libs/minify
create mode 100755 _libs/postprocess
diff --git a/.builds/auto.yml b/.builds/auto.yml
index c5b9a7b..34756e1 100644
--- a/.builds/auto.yml
+++ b/.builds/auto.yml
@@ -19,7 +19,7 @@ tasks:
- build: |
cd site
nix-shell .builds/shell.nix --run 'julia --project=@. .builds/franklin.jl'
- nix-shell -p python3Packages.css-html-js-minify --run _libs/minify
+ nix-shell -p python3Packages.css-html-js-minify --run _libs/postprocess
- deploy: |
tar -cvzf site.tar.gz -C site/__site .
acurl -f https://pages.sr.ht/publish/cnx.srht.site -F content=@site.tar.gz
diff --git a/.builds/shell.nix b/.builds/shell.nix
index 3f21d40..b73cc6c 100644
--- a/.builds/shell.nix
+++ b/.builds/shell.nix
@@ -1,12 +1,15 @@
with import {};
mkShell {
nativeBuildInputs = [
- julia-bin nodejs nodePackages.katex
- ] ++ (with python3Packages; [ bleach markdown ]);
+ julia-bin nodejs nodePackages.katex python3Packages.formbox
+ ];
shellHook = ''
npm install highlight.js # https://github.com/NixOS/nixpkgs/issues/152201
- ln -fns ${nodePackages.katex}/lib/node_modules/katex/dist _libs/katex
- ln -fs _libs/katex/{fonts,katex.min.css} _css
+ katex=${nodePackages.katex}/lib/node_modules/katex/dist
+ install -m 755 -d _css/fonts _libs/katex
+ install -m 644 $katex/katex.min.css _css
+ install -m 644 $katex/fonts/* _css/fonts
+ install -m 644 $katex/{katex.min.js,contrib/auto-render.min.js} _libs/katex
'';
}
diff --git a/README.md b/README.md
index 7030b3d..e639285 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ This is my Franklin-generated static site, *without* client-side scripts.
## Building
julia --project=@. .builds/franklin.jl
- _libs/minify
+ _libs/postprocess
### Explicit dependencies
diff --git a/_css/style.css b/_css/style.css
index af502d7..fa15219 100644
--- a/_css/style.css
+++ b/_css/style.css
@@ -20,6 +20,7 @@
--block-bg: var(--black);
--fade-fg: var(--bright-black);
--link-fg: var(--green);
+ --overlay-bg: #8881;
--text-bg: #121212;
--text-fg: var(--bright-white);
}
@@ -42,7 +43,7 @@ html {
font-size: min(max(100%, 2vw), 150%);
margin: auto;
max-width: 36rem;
- scrollbar-color: var(--fade-fg) var(--block-bg);
+ scrollbar-color: var(--fade-fg) var(--overlay-bg);
}
body { margin: 0 1rem }
@@ -50,7 +51,7 @@ body { margin: 0 1rem }
.franklin-content .row { display: block }
/* Text geometry */
-.franklin-content p {
+p, details {
hyphens: auto;
line-height: 1.4rem;
text-align: justify;
@@ -129,7 +130,7 @@ body { margin: 0 1rem }
.note p:first-child { font-weight: bold }
.franklin-content blockquote {
- background: var(--block-bg);
+ background: var(--overlay-bg);
border-left: 0.25rem solid var(--fade-fg);
}
@@ -228,13 +229,14 @@ code, .hljs {
.hljs-addition { color: var(--red) }
.comment {
- background-color: #8881;
+ background-color: var(--overlay-bg);
clear: both;
margin: 1ex 0;
overflow: hidden;
padding: 1ex;
}
.comment p { margin: 1ex }
+.comment blockquote, .comment .note { margin: -1ex -1ex 0 }
.openring {
display: flex;
@@ -244,7 +246,7 @@ code, .hljs {
}
.openring h3 { margin: 0 0 1ex }
.openring article {
- background: var(--block-bg);
+ background: var(--overlay-bg);
display: flex;
flex-direction: column;
flex: 1 1 0;
diff --git a/_layout/page_foot.html b/_layout/page_foot.html
index f6745c4..bb10e5a 100644
--- a/_layout/page_foot.html
+++ b/_layout/page_foot.html
@@ -8,5 +8,5 @@
{{comments_rendered}}
Follow the anchor in an author's name to reply via
plaintext email. Markdown
- inline markups, block quotes and code blocks are supported.
{{end}}
+ inline markups, block quotes, lists and code blocks are supported.
{{end}}
{{insert footer.html}}
diff --git a/_libs/formbox/comment.html b/_libs/formbox/comment.html
index 60459d9..fe7aa6a 100644
--- a/_libs/formbox/comment.html
+++ b/_libs/formbox/comment.html
@@ -1,6 +1,7 @@
—{author}, +
—{author}, {date}
{children} diff --git a/_libs/formbox/format b/_libs/formbox/format deleted file mode 100755 index bad40db..0000000 --- a/_libs/formbox/format +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# Format mbox as HTML/XML -# Copyright (C) 2021 Nguyễn Gia Phong -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see)?\s*
)?\s*