diff options
author | Silvan Mosberger <silvan.mosberger@tweag.io> | 2022-12-23 20:57:19 +0100 |
---|---|---|
committer | Silvan Mosberger <silvan.mosberger@tweag.io> | 2022-12-23 21:10:16 +0100 |
commit | b3792b44c55ce58147055e553cd45f1f04ca3e51 (patch) | |
tree | da87227ff1c866dc2011fe93312644c094ae5e5f /doc/doc-support | |
parent | 26d95bda2fabb127d13e4346db6fa241d5cb2da9 (diff) |
lib: correctly render docs for nested identifiers
Applies https://github.com/nix-community/nixdoc/pull/27 and fixes up the location information rendering, allowing lib functions to be nested in further scopes Needed for later commits
Diffstat (limited to 'doc/doc-support')
-rw-r--r-- | doc/doc-support/lib-function-locations.nix | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/doc/doc-support/lib-function-locations.nix b/doc/doc-support/lib-function-locations.nix index ae1123c63ad30..3ede09ba50f58 100644 --- a/doc/doc-support/lib-function-locations.nix +++ b/doc/doc-support/lib-function-locations.nix @@ -2,19 +2,21 @@ let revision = pkgs.lib.trivial.revisionWithDefault (nixpkgs.revision or "master"); - libDefPos = set: - builtins.map - (name: { - name = name; + libDefPos = prefix: set: + builtins.concatMap + (name: [{ + name = builtins.concatStringsSep "." (prefix ++ [name]); location = builtins.unsafeGetAttrPos name set; - }) - (builtins.attrNames set); + }] ++ nixpkgsLib.optionals + (builtins.length prefix == 0 && builtins.isAttrs set.${name}) + (libDefPos (prefix ++ [name]) set.${name}) + ) (builtins.attrNames set); libset = toplib: builtins.map (subsetname: { subsetname = subsetname; - functions = libDefPos toplib.${subsetname}; + functions = libDefPos [] toplib.${subsetname}; }) (builtins.map (x: x.name) libsets); |