From c693500a72fcceb559a3c8cc58962d482cb6aade Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Mon, 21 Oct 2024 19:14:42 +0100 Subject: [PATCH] docs: simplify `mdbook.nixvimOptions` impl --- docs/mdbook/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/mdbook/default.nix b/docs/mdbook/default.nix index fe6e76cb..b71d07b8 100644 --- a/docs/mdbook/default.nix +++ b/docs/mdbook/default.nix @@ -208,7 +208,7 @@ let nixvimOptions = mapModulesToString ( name: opts: let - isBranch = if name == "index" then true else opts.hasComponents && opts.index.options != { }; + isBranch = name == "index" || (opts.hasComponents && opts.index.options != { }); path = if isBranch then @@ -218,9 +218,9 @@ let else ""; - indentLevel = with builtins; length (filter isString (split "/" opts.index.path)) - 1; + indentLevel = lib.count (c: c == "/") (lib.stringToCharacters opts.index.path); - padding = lib.concatStrings (builtins.genList (_: "\t") indentLevel); + padding = lib.strings.replicate indentLevel "\t"; in "${padding}- [${name}](${path})" ) docs.modules;