diff options
author | Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> | 2022-11-29 15:55:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 15:55:43 +0100 |
commit | 0596bdf3a9a42e73c68584da1401781a0e888f09 (patch) | |
tree | 345e18ff93d236bbb9607b45bd88bfa9e699e85c /doc/manual | |
parent | fbc53e97edfff092e6a4c1b7f0546137fdb6238c (diff) | |
parent | d6318e1638ed17fef701ada19ec7fde4b54d3bcf (diff) |
Merge pull request #7342 from fricklerhandwerk/refactor-generate-builtins
refactor rendering documentation of builtins
Diffstat (limited to 'doc/manual')
-rw-r--r-- | doc/manual/generate-builtins.nix | 32 |
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)) |