aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/generate-builtins.nix
blob: 71f96153f4ab16749c956cf86b176c1ffb2bec4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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))