aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/generate-builtins.nix
diff options
context:
space:
mode:
authorValentin Gagarin <valentin.gagarin@tweag.io>2022-11-24 13:47:08 +0100
committerValentin Gagarin <valentin.gagarin@tweag.io>2022-11-24 14:15:43 +0100
commitd6318e1638ed17fef701ada19ec7fde4b54d3bcf (patch)
tree6b78ae703d82a032adf0022ee5631d6633a57092 /doc/manual/generate-builtins.nix
parentbc9692a6b701fffe25d2e3b1d16f00edd596930f (diff)
refactor rendering documentation of builtins
as in [1], make the document structure visible, like in a template [1]: 4655563470b59e0ef50a33af003058c2b54db778
Diffstat (limited to 'doc/manual/generate-builtins.nix')
-rw-r--r--doc/manual/generate-builtins.nix32
1 files changed, 18 insertions, 14 deletions
diff --git a/doc/manual/generate-builtins.nix b/doc/manual/generate-builtins.nix
index 6c8b88da2..115bb3f94 100644
--- a/doc/manual/generate-builtins.nix
+++ b/doc/manual/generate-builtins.nix
@@ -1,16 +1,20 @@
-with builtins;
-with import ./utils.nix;
+builtinsDump:
+let
+ showBuiltin = name:
+ let
+ inherit (builtinsDump.${name}) doc args;
+ in
+ ''
+ <dt id="builtins-${name}">
+ <a href="#builtins-${name}"><code>${name} ${listArgs args}</code></a>
+ </dt>
+ <dd>
-builtins:
+ ${doc}
+
+ </dd>
+ '';
+ listArgs = args: builtins.concatStringsSep " " (map (s: "<var>${s}</var>") args);
+in
+with builtins; concatStringsSep "\n" (map showBuiltin (attrNames builtinsDump))
-concatStrings (map
- (name:
- let builtin = builtins.${name}; in
- "<dt id=\"builtins-${name}\"><a href=\"#builtins-${name}\"><code>${name} "
- + concatStringsSep " " (map (s: "<var>${s}</var>") builtin.args)
- + "</code></a></dt>"
- + "<dd>\n\n"
- + builtin.doc
- + "\n\n</dd>"
- )
- (attrNames builtins))