nix-super/doc/manual/generate-builtins.nix

25 lines
481 B
Nix
Raw Normal View History

let
inherit (builtins) concatStringsSep attrNames;
in
builtinsInfo:
let
showBuiltin = name:
let
inherit (builtinsInfo.${name}) doc args;
in
''
<dt id="builtins-${name}">
<a href="#builtins-${name}"><code>${name} ${listArgs args}</code></a>
</dt>
<dd>
2020-09-16 15:55:24 +03:00
${doc}
</dd>
'';
listArgs = args: concatStringsSep " " (map (s: "<var>${s}</var>") args);
in
concatStringsSep "\n" (map showBuiltin (attrNames builtinsInfo))
2020-09-16 15:55:24 +03:00