forked from lix-project/lix
5d78dc4176
* 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))
|
|
|