Update with subsetting scripts

This commit is contained in:
Danila Fedorin 2025-02-23 21:07:14 +00:00
parent b0ca0f3916
commit d25e8219f2
3 changed files with 22 additions and 11 deletions

View File

@ -34,11 +34,15 @@ cp -r $agdaHtml/* code/
# Static folder changed, re-run Hugo # Static folder changed, re-run Hugo
hugo $hugoFlags --config=config.toml,config-urls.toml hugo $hugoFlags --config=config.toml,config-urls.toml
# Output result # Do post-processing of HTML files: render math, link up Agda code, subset fonts and icons
mkdir $out gendir="public/$publicPath"
cp -r public/$publicPath/* $out/ htmlfiles=$(find $gendir/ -regex "$gendir/.*\.html")
chmod -R u+w $gendir
# Do post-processing of HTML files: render math and link up Agda code
htmlfiles=$(find $out/ -regex "$out/.*\.html")
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 ./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 ./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/

8
flake.lock generated
View File

@ -23,11 +23,11 @@
"blog-source": { "blog-source": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1735245303, "lastModified": 1740345918,
"narHash": "sha256-dqBLJ456fQtTwL594j3265ctqALan0PzrWreu2qpT2w=", "narHash": "sha256-FVG/2NXiKJAxmvQJCqzK7GVOFu/NkN/L2x0ndMDAfEk=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "7130c6bd1124dd048d2ede082e3502d8924b8939", "rev": "11be991946cb8e6d0d710077fc6478e782fdfc94",
"revCount": 899, "revCount": 909,
"submodules": true, "submodules": true,
"type": "git", "type": "git",
"url": "https://dev.danilafe.com/Web-Projects/blog-static.git" "url": "https://dev.danilafe.com/Web-Projects/blog-static.git"

View File

@ -14,6 +14,13 @@ let
gemset = ./gemset.nix; gemset = ./gemset.nix;
}; };
pythonEnv = python3.withPackages (python-pkgs: [
python-pkgs.beautifulsoup4
python-pkgs.lxml
python-pkgs.fonttools
python-pkgs.brotli
]);
# --- Building Agda HTML --- # --- Building Agda HTML ---
agdaEnv = agda.withPackages [ agdaPackages.standard-library ]; agdaEnv = agda.withPackages [ agdaPackages.standard-library ];
agdaHtml = settings: agdaHtml = settings:
@ -52,7 +59,7 @@ let
gems = gems settings; gems = gems settings;
agdaHtml = agdaHtml settings; agdaHtml = agdaHtml settings;
buildInputs = [ buildInputs = [
hugo ruby stork agdaEnv hugo ruby stork agdaEnv pythonEnv
]; ];
}; };
in in