diff --git a/build/builder.sh b/build/builder.sh index bf0a1ea..53238a8 100644 --- a/build/builder.sh +++ b/build/builder.sh @@ -34,11 +34,15 @@ cp -r $agdaHtml/* code/ # Static folder changed, re-run Hugo hugo $hugoFlags --config=config.toml,config-urls.toml -# Output result -mkdir $out -cp -r public/$publicPath/* $out/ - -# Do post-processing of HTML files: render math and link up Agda code -htmlfiles=$(find $out/ -regex "$out/.*\.html") +# Do post-processing of HTML files: render math, link up Agda code, subset fonts and icons +gendir="public/$publicPath" +htmlfiles=$(find $gendir/ -regex "$gendir/.*\.html") +chmod -R u+w $gendir echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./convert.rb --katex-js-file static/katex/katex.min.js echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./agda.rb +echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./chatgpt-subset-feather-icon.rb $gendir/feather-sprite.svg +echo $htmlfiles | xargs python3 chatgpt-subset-one-go.py $gendir + +# Output result +mkdir $out +cp -r $gendir/* $out/ diff --git a/flake.lock b/flake.lock index 76efbcf..ef9e24c 100644 --- a/flake.lock +++ b/flake.lock @@ -23,11 +23,11 @@ "blog-source": { "flake": false, "locked": { - "lastModified": 1735245303, - "narHash": "sha256-dqBLJ456fQtTwL594j3265ctqALan0PzrWreu2qpT2w=", + "lastModified": 1740345918, + "narHash": "sha256-FVG/2NXiKJAxmvQJCqzK7GVOFu/NkN/L2x0ndMDAfEk=", "ref": "refs/heads/master", - "rev": "7130c6bd1124dd048d2ede082e3502d8924b8939", - "revCount": 899, + "rev": "11be991946cb8e6d0d710077fc6478e782fdfc94", + "revCount": 909, "submodules": true, "type": "git", "url": "https://dev.danilafe.com/Web-Projects/blog-static.git" diff --git a/lib.nix b/lib.nix index 708ed40..8ab55b5 100644 --- a/lib.nix +++ b/lib.nix @@ -14,6 +14,13 @@ let gemset = ./gemset.nix; }; + pythonEnv = python3.withPackages (python-pkgs: [ + python-pkgs.beautifulsoup4 + python-pkgs.lxml + python-pkgs.fonttools + python-pkgs.brotli + ]); + # --- Building Agda HTML --- agdaEnv = agda.withPackages [ agdaPackages.standard-library ]; agdaHtml = settings: @@ -52,7 +59,7 @@ let gems = gems settings; agdaHtml = agdaHtml settings; buildInputs = [ - hugo ruby stork agdaEnv + hugo ruby stork agdaEnv pythonEnv ]; }; in