doc: Render lib.fixedPoints

This commit is contained in:
Robert Hensing
2023-07-08 18:43:36 +02:00
parent e08fab0406
commit aa1beb0ab5
3 changed files with 126 additions and 88 deletions

View File

@@ -14,13 +14,16 @@ stdenv.mkDerivation {
buildInputs = [ nixdoc ];
installPhase = ''
function docgen {
# TODO: wrap lib.$1 in <literal>, make nixdoc not escape it
if [[ -e "../lib/$1.nix" ]]; then
nixdoc -c "$1" -d "lib.$1: $2" -l ${locationsJSON} -f "$1.nix" > "$out/$1.md"
name=$1
baseName=$2
description=$3
# TODO: wrap lib.$name in <literal>, make nixdoc not escape it
if [[ -e "../lib/$baseName.nix" ]]; then
nixdoc -c "$name" -d "lib.$name: $description" -l ${locationsJSON} -f "$baseName.nix" > "$out/$name.md"
else
nixdoc -c "$1" -d "lib.$1: $2" -l ${locationsJSON} -f "$1/default.nix" > "$out/$1.md"
nixdoc -c "$name" -d "lib.$name: $description" -l ${locationsJSON} -f "$baseName/default.nix" > "$out/$name.md"
fi
echo "$out/$1.md" >> "$out/index.md"
echo "$out/$name.md" >> "$out/index.md"
}
mkdir -p "$out"
@@ -29,8 +32,8 @@ stdenv.mkDerivation {
```{=include=} sections
EOF
${lib.concatMapStrings ({ name, description }: ''
docgen ${name} ${lib.escapeShellArg description}
${lib.concatMapStrings ({ name, baseName ? name, description }: ''
docgen ${name} ${baseName} ${lib.escapeShellArg description}
'') libsets}
echo '```' >> "$out/index.md"