From 0be95e63bb7940b37e46d3d1ae447136b20cf7a3 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Thu, 10 Sep 2020 16:21:08 -0400 Subject: [PATCH 1/2] Rebuild tutorials on copy script changes --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f5c0aa98cb..5ca4f50007 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ NIX_DEV_MANUAL_OUT = guides all: $(NIX_DEV_MANUAL_OUT) learn_guides.html.in -$(NIX_DEV_MANUAL_OUT) learn_guides.html.in: $(NIX_DEV_MANUAL_IN) layout.tt +$(NIX_DEV_MANUAL_OUT) learn_guides.html.in: $(NIX_DEV_MANUAL_IN) layout.tt copy-nix-dev-tutorials.sh bash copy-nix-dev-tutorials.sh $(NIX_DEV_MANUAL_OUT) From 8e8ccecd3bc89d14561a5f048e43902b2efbe819 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Thu, 10 Sep 2020 16:21:28 -0400 Subject: [PATCH 2/2] copy-nix-dev-tutorials: use printf to fix title The title was using what amounted to: echo '[% $title %]' > file.tt Which put the literal `$title` perl variable, which in Template Toolkit, an undefined variable is equivalent to an empty string. This made the of the page be "NixOS - Guides - ". This fixes that by using the better `printf` building for building strings to print. Additionally we can drop the empty echoes and use `\n` as printf honours them. --- copy-nix-dev-tutorials.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/copy-nix-dev-tutorials.sh b/copy-nix-dev-tutorials.sh index 7652803301..b6d23d7109 100755 --- a/copy-nix-dev-tutorials.sh +++ b/copy-nix-dev-tutorials.sh @@ -26,8 +26,7 @@ for page in "${pages[@]}"; do echo "<li><a href=\"/$outDir/$filename.html\">$title</a></li>" >> learn_guides.html.in - echo '[% WRAPPER layout.tt title="Guides - $title" %]' > $target - echo '' >> $target + printf '[%% WRAPPER layout.tt title="Guides - %s" %%]\n\n' "$title" > $target xidel $source --css '.body > *' --printed-node-format=html \ | sed 's|<a class=\"headerlink\".*<\/a>||g' \ @@ -37,6 +36,5 @@ for page in "${pages[@]}"; do | sed 's|../reference/pinning-nixpkgs.html#ref-pinning-nixpkgs|towards-reproducibility-pinning-nixpkgs.html|g' \ >> "$target" - echo '' >> $target - echo "[% END %]" >> $target + printf '\n\n[%% END %%]\n' >> $target done