2023-05-03 09:16:29 +02:00
let
2023-05-13 19:52:45 +02:00
inherit ( builtins ) concatStringsSep attrValues mapAttrs ;
inherit ( import ./utils.nix ) optionalString squash ;
2023-05-03 09:16:29 +02:00
in
builtinsInfo :
2022-11-24 13:47:08 +01:00
let
2024-04-05 01:07:44 +02:00
showBuiltin =
name :
{
doc ,
args ,
arity ,
experimental-feature ,
} :
2022-11-24 13:47:08 +01:00
let
2023-05-13 19:52:45 +02:00
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.
'' ;
2022-11-24 13:47:08 +01:00
in
2023-05-13 19:52:45 +02:00
squash ''
2022-11-24 13:47:08 +01:00
< dt id = " b u i l t i n s - ${ name } " >
< a href = " # b u i l t i n s - ${ name } " > <code> $ { name } $ { listArgs args } < /code > < /a >
< /dt >
<dd>
2020-09-16 14:55:24 +02:00
2023-05-13 19:52:45 +02:00
$ { doc }
$ { experimentalNotice }
2022-11-24 13:47:08 +01:00
< /dd >
'' ;
2023-05-03 09:16:29 +02:00
listArgs = args : concatStringsSep " " ( map ( s : " < v a r > ${ s } < / v a r > " ) args ) ;
2022-11-24 13:47:08 +01:00
in
2023-05-13 19:52:45 +02:00
concatStringsSep " \n " ( attrValues ( mapAttrs showBuiltin builtinsInfo ) )