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