From 0ba29c56f8e86848556e9087b07eb8b38f04d9f5 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Sun, 11 Nov 2007 09:27:52 +0000 Subject: [PATCH] Added converter from new option description format to needed for docbook generation. svn path=/nixpkgs/trunk/; revision=9626 --- pkgs/lib/default.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index 0ac86d1e48d5..33b7b3d6c9e5 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -230,5 +230,18 @@ rec { else addDefaultOptionValues defValue {}; } ) (builtins.attrNames defs)); + + optionAttrSetToDocList = (l: attrs: + (if (getAttr ["_type"] "" attrs) == "option" then + [({ + inherit (attrs) description; + } + //(if attrs ? example then {inherit(attrs) example;} else {} ) + //(if attrs ? default then {inherit(attrs) default;} else {} ) + //{name = l;} + )] + else (concatLists (map (s: (optionAttrSetToDocList + (l + (if l=="" then "" else ".") + s) (builtins.getAttr s attrs))) + (builtins.attrNames attrs))))); }