mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
docs/mdbook: support visible = "shallow"
This commit is contained in:
parent
2f5374c3dc
commit
f584d1d70d
1 changed files with 20 additions and 7 deletions
|
@ -35,18 +35,31 @@ let
|
||||||
removeWhitespace = builtins.replaceStrings [ " " ] [ "" ];
|
removeWhitespace = builtins.replaceStrings [ " " ] [ "" ];
|
||||||
|
|
||||||
getSubOptions =
|
getSubOptions =
|
||||||
opts: path: lib.optionalAttrs (isVisible opts) (removeUnwanted (opts.type.getSubOptions path));
|
opts: path:
|
||||||
|
lib.optionalAttrs (isDeeplyVisible opts) (removeUnwanted (opts.type.getSubOptions path));
|
||||||
|
|
||||||
isVisible =
|
isVisible = isVisibleWith true;
|
||||||
opts:
|
isDeeplyVisible = isVisibleWith false;
|
||||||
|
|
||||||
|
isVisibleWith =
|
||||||
|
shallow: opts:
|
||||||
|
let
|
||||||
|
test =
|
||||||
|
opt:
|
||||||
|
let
|
||||||
|
internal = opt.internal or false;
|
||||||
|
visible = opt.visible or true;
|
||||||
|
visible' = if visible == "shallow" then shallow else visible;
|
||||||
|
in
|
||||||
|
visible' && !internal;
|
||||||
|
in
|
||||||
if lib.isOption opts then
|
if lib.isOption opts then
|
||||||
opts.visible or true && !(opts.internal or false)
|
test opts
|
||||||
else if opts.isOption then
|
else if opts.isOption then
|
||||||
opts.index.options.visible or true && !(opts.index.options.internal or false)
|
test opts.index.options
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
filterFunc = lib.filterAttrs (_: v: if lib.isAttrs v then isVisible v else true);
|
filterFunc = lib.filterAttrs (_: v: if lib.isAttrs v then isVisibleWith shallow v else true);
|
||||||
|
|
||||||
hasEmptyIndex = (filterFunc opts.index.options) == { };
|
hasEmptyIndex = (filterFunc opts.index.options) == { };
|
||||||
hasEmptyComponents = (filterFunc opts.components) == { };
|
hasEmptyComponents = (filterFunc opts.components) == { };
|
||||||
in
|
in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue