diff --git a/docs/hooks/render_options.py b/docs/hooks/render_options.py index 025a799d0f..4bfb8cf5c1 100644 --- a/docs/hooks/render_options.py +++ b/docs/hooks/render_options.py @@ -41,25 +41,6 @@ def sort_options(item: Tuple[str, Dict], module_name: str) -> int: return ord(name[0]) -def preprocess_options(options, module_name): - tree = dict() - for name, option in options.items(): - if name.startswith("_module"): - continue - cursor = tree - parts = name.split(".") - for index, part in enumerate(parts): - if part not in cursor: - if index + 1 == len(parts): - cursor[part] = dict(**option, children={}) - else: - cursor[part] = dict(children=dict()) - cursor = cursor[part]["children"] - else: - cursor = cursor[part]["children"] - return OrderedDict(sorted(tree.items(), key=lambda i: sort_options(i, module_name))) - - def on_page_markdown( markdown: str, page: Page, config: MkDocsConfig, files: Files ) -> str | None: @@ -84,7 +65,8 @@ def on_page_markdown( log.error(f"{options_path} does not exist") return None with open(options_path, "r") as f: - options = preprocess_options(json.load(f), module_name) + options = json.load(f) + del options["_module.args"] reference = env.get_template("reference_options.html").render(options=options) return "\n\n".join([header, markdown, reference]) diff --git a/modules/flake-parts/reference-website/default.nix b/modules/flake-parts/reference-website/default.nix index f6720a9b32..fdceb83a20 100644 --- a/modules/flake-parts/reference-website/default.nix +++ b/modules/flake-parts/reference-website/default.nix @@ -148,7 +148,7 @@ if [ ! -d src/reference ]; then echo "linking .#reference to src/reference, you need to update this manually\ and remove it before a production build" - ln -sfT $(nix build ..#reference --no-link --print-out-paths) src/reference + ln -sfT $(nix build .#optionsReference --no-link --print-out-paths) src/reference fi ''; };