mirror of
https://github.com/nix-community/nixvim.git
synced 2025-12-19 23:41:13 +01:00
docs/mdbook: refactor isVisible's "has visible" check
This commit is contained in:
parent
5ef378a006
commit
79ace278ec
1 changed files with 8 additions and 8 deletions
|
|
@ -66,6 +66,10 @@ let
|
||||||
visible' = if lib.isBool visible then visible else visible != "transparent";
|
visible' = if lib.isBool visible then visible else visible != "transparent";
|
||||||
in
|
in
|
||||||
visible' && !internal;
|
visible' && !internal;
|
||||||
|
|
||||||
|
# FIXME: isVisible is not a perfect check;
|
||||||
|
# it will false-positive on `visible = "transparent"`
|
||||||
|
hasVisible = opts: lib.any (v: lib.isAttrs v -> isVisible v) (lib.attrValues opts);
|
||||||
in
|
in
|
||||||
opts:
|
opts:
|
||||||
if lib.isOption opts then
|
if lib.isOption opts then
|
||||||
|
|
@ -73,14 +77,10 @@ let
|
||||||
else if opts.isOption then
|
else if opts.isOption then
|
||||||
test opts.index.options
|
test opts.index.options
|
||||||
else
|
else
|
||||||
let
|
lib.any hasVisible [
|
||||||
# FIXME: isVisible is not a perfect check;
|
opts.index.options
|
||||||
# it will false-positive on `visible = "transparent"`
|
opts.components
|
||||||
filterFunc = lib.filterAttrs (_: v: if lib.isAttrs v then isVisible v else true);
|
];
|
||||||
hasEmptyIndex = (filterFunc opts.index.options) == { };
|
|
||||||
hasEmptyComponents = (filterFunc opts.components) == { };
|
|
||||||
in
|
|
||||||
!hasEmptyIndex || !hasEmptyComponents;
|
|
||||||
|
|
||||||
wrapOptionDocPage = path: opts: isOpt: rec {
|
wrapOptionDocPage = path: opts: isOpt: rec {
|
||||||
index = {
|
index = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue