From 381ac1fc3d98ecd0b6f5215c54f907eac6d2b873 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 12 Feb 2020 09:26:16 -0300 Subject: html tidy wip --- default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index c664429..0f98063 100644 --- a/default.nix +++ b/default.nix @@ -33,9 +33,10 @@ in rec { }); docs = utils.baseTask.overrideAttrs (baseAttrs: { name = "${baseAttrs.name}-docs"; - buildInputs = [ jekyllEnv ]; + buildInputs = [ jekyllEnv pkgs.html-tidy ]; buildPhase = '' jekyll build -d $out + find $out -type f -name '*.html' | xargs -I{} tidy -errors -utf8 -indent -modify {} ''; }); }; @@ -51,6 +52,7 @@ in rec { buildInputs = [ jekyllEnv (pkgs.hunspellWithDicts (with pkgs.hunspellDicts; [ en-us ])) + pkgs.html-tidy ]; }; publishScript = utils.overwritingPublishScript { -- cgit v1.2.3 From e70a82008013769abb408ff29871826c5d0ffca8 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 14 Feb 2020 22:59:19 -0300 Subject: Call tidy-content.sh in build derivation --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index 0f98063..4fbdc61 100644 --- a/default.nix +++ b/default.nix @@ -36,7 +36,7 @@ in rec { buildInputs = [ jekyllEnv pkgs.html-tidy ]; buildPhase = '' jekyll build -d $out - find $out -type f -name '*.html' | xargs -I{} tidy -errors -utf8 -indent -modify {} + ./scripts/tidy-content.sh $out ''; }); }; -- cgit v1.2.3 From 5dc77abbdda39c7539fd6eb780db2d1b63f0a266 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 14 Feb 2020 22:59:46 -0300 Subject: Add building docs to test derivation --- default.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'default.nix') diff --git a/default.nix b/default.nix index 4fbdc61..537c2ae 100644 --- a/default.nix +++ b/default.nix @@ -35,6 +35,7 @@ in rec { name = "${baseAttrs.name}-docs"; buildInputs = [ jekyllEnv pkgs.html-tidy ]; buildPhase = '' + patchShebangs . jekyll build -d $out ./scripts/tidy-content.sh $out ''; @@ -46,6 +47,7 @@ in rec { (utils.fixme null) subtasks.hunspellCheck subtasks.assertContent + subtasks.docs ]; shell = pkgs.mkShell rec { name = "website-shell"; -- cgit v1.2.3 From 43a9e4eb977477275086b65bc5337f520499e08e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 14 Feb 2020 23:06:27 -0300 Subject: Improve error message of tidy-content.sh --- default.nix | 6 +++++- scripts/tidy-content.sh | 8 ++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index 537c2ae..2f10691 100644 --- a/default.nix +++ b/default.nix @@ -37,7 +37,11 @@ in rec { buildPhase = '' patchShebangs . jekyll build -d $out - ./scripts/tidy-content.sh $out + ./scripts/tidy-content.sh $out || { + echo 'Error in formatting HTML. Reproduce with: ' + echo ' jekyll build && ./scripts/tidy-content.sh _site/' + exit 1 + } ''; }); }; diff --git a/scripts/tidy-content.sh b/scripts/tidy-content.sh index 2ccb925..6dc13c6 100755 --- a/scripts/tidy-content.sh +++ b/scripts/tidy-content.sh @@ -26,12 +26,8 @@ INPUT_DIR="${1:-}" } format() { - FILE="${1}" - echo "${FILE}" >&2 - if ! tidy --quiet yes -utf8 -indent -modify "${FILE}"; then - echo "Error in formatting '${FILE}'." >&2 - exit 1 - fi + echo "${1}" >&2 + tidy --quiet yes -utf8 -indent -modify "${1}" } export -f format -- cgit v1.2.3