mirror of
https://github.com/NixOS/nix.git
synced 2025-02-19 18:32:36 +00:00

* doc rendering: add functions to scope explicitly this especially helps beginners with code readability, since the origin of names is always immediately visible.
25 lines
481 B
Nix
25 lines
481 B
Nix
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>
|
|
|
|
${doc}
|
|
|
|
</dd>
|
|
'';
|
|
listArgs = args: concatStringsSep " " (map (s: "<var>${s}</var>") args);
|
|
in
|
|
concatStringsSep "\n" (map showBuiltin (attrNames builtinsInfo))
|
|
|