diff options
author | Valentin Gagarin <valentin.gagarin@tweag.io> | 2023-05-03 09:16:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-03 07:16:29 +0000 |
commit | 5d78dc41760c504240101e77eb38c47fec58bdbd (patch) | |
tree | 64b2a30e16dab5676c7b9e293f8e6098d66d275c /doc/manual/generate-builtins.nix | |
parent | 1540ab762819d047b6c964ddcf1a2679faf8a48c (diff) |
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.
Diffstat (limited to 'doc/manual/generate-builtins.nix')
-rw-r--r-- | doc/manual/generate-builtins.nix | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/doc/manual/generate-builtins.nix b/doc/manual/generate-builtins.nix index 115bb3f94..71f96153f 100644 --- a/doc/manual/generate-builtins.nix +++ b/doc/manual/generate-builtins.nix @@ -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)) |