diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-05-13 13:52:45 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-06-27 09:37:54 -0400 |
commit | 22b278e011ab9c1328749a126514c57b89a39173 (patch) | |
tree | 0920c88b6bc996502f5ebf153fcb4c8956321e6e /doc/manual/generate-builtins.nix | |
parent | d40f0e534d657e619634ba204fb8970f4a01fbc5 (diff) |
Automatically document builtin constants
This is done in roughly the same way builtin functions are documented.
Also auto-link experimental features for primops, subsuming PR #8371.
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Diffstat (limited to 'doc/manual/generate-builtins.nix')
-rw-r--r-- | doc/manual/generate-builtins.nix | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/doc/manual/generate-builtins.nix b/doc/manual/generate-builtins.nix index 71f96153f..813a287f5 100644 --- a/doc/manual/generate-builtins.nix +++ b/doc/manual/generate-builtins.nix @@ -1,24 +1,28 @@ let - inherit (builtins) concatStringsSep attrNames; + inherit (builtins) concatStringsSep attrValues mapAttrs; + inherit (import ./utils.nix) optionalString squash; in builtinsInfo: let - showBuiltin = name: + showBuiltin = name: { doc, args, arity, experimental-feature }: let - inherit (builtinsInfo.${name}) doc args; + experimentalNotice = optionalString (experimental-feature != null) '' + This function is only available if the [${experimental-feature}](@docroot@/contributing/experimental-features.md#xp-feature-${experimental-feature}) experimental feature is enabled. + ''; in - '' + squash '' <dt id="builtins-${name}"> <a href="#builtins-${name}"><code>${name} ${listArgs args}</code></a> </dt> <dd> - ${doc} + ${doc} + + ${experimentalNotice} </dd> ''; listArgs = args: concatStringsSep " " (map (s: "<var>${s}</var>") args); in -concatStringsSep "\n" (map showBuiltin (attrNames builtinsInfo)) - +concatStringsSep "\n" (attrValues (mapAttrs showBuiltin builtinsInfo)) |