mirror of
https://github.com/NixOS/nix
synced 2025-06-24 18:01:16 +02:00
doc rendering: add functions to scope explicitly (#7378)
* doc rendering: add functions to scope explicitly this especially helps beginners with code readability, since the origin of names is always immediately visible.
This commit is contained in:
parent
1540ab7628
commit
5d78dc4176
2 changed files with 21 additions and 13 deletions
|
@ -1,8 +1,12 @@
|
|||
builtinsDump:
|
||||
let
|
||||
inherit (builtins) concatStringsSep attrNames;
|
||||
in
|
||||
|
||||
builtinsInfo:
|
||||
let
|
||||
showBuiltin = name:
|
||||
let
|
||||
inherit (builtinsDump.${name}) doc args;
|
||||
inherit (builtinsInfo.${name}) doc args;
|
||||
in
|
||||
''
|
||||
<dt id="builtins-${name}">
|
||||
|
@ -14,7 +18,7 @@ let
|
|||
|
||||
</dd>
|
||||
'';
|
||||
listArgs = args: builtins.concatStringsSep " " (map (s: "<var>${s}</var>") args);
|
||||
listArgs = args: concatStringsSep " " (map (s: "<var>${s}</var>") args);
|
||||
in
|
||||
with builtins; concatStringsSep "\n" (map showBuiltin (attrNames builtinsDump))
|
||||
concatStringsSep "\n" (map showBuiltin (attrNames builtinsInfo))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue