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