1{ 2 setuptools, 3 mkdocs, 4 mkdocs-macros, 5 mkdocs-material, 6 runCommand, 7 callPackage, 8}: 9 10let 11 inherit (mkdocs-macros) pname version src; 12 13 mkdocs-macros-test = callPackage ./mkdocs-macros-test.nix { }; 14 15 env = { 16 nativeBuildInputs = [ 17 setuptools 18 mkdocs 19 mkdocs-macros 20 mkdocs-macros-test 21 mkdocs-material 22 ]; 23 }; 24in 25runCommand "mkdocs-macros-example-docs" env '' 26 set -euo pipefail 27 mkdir $out 28 29 base_dir=${pname}-${version}/test 30 tar --extract "--file=${src}" 31 32 for test_dir in $base_dir/*/; do 33 pushd $test_dir 34 mkdocs build --site-dir=$out/$test_dir 35 popd 36 done 37 38 # Do some static checks on the generated content 39 pushd $out/$base_dir 40 # Non-existent variables 41 cat debug/index.html | grep "another one: that" 42 # File inclusion 43 cat module/index.html | grep "part from an <em>included</em> file!" 44 # Variable replacement 45 cat module_dir/index.html | grep "total costs is 50 euros" 46 # New syntax with square brackets 47 cat new_syntax/index.html | grep "expensive" 48 # General info on macros 49 cat simple/index.html | grep "Macros Plugin Environment" 50''