3
0
Fork 0
forked from mirrors/nixpkgs

nixos/make-options-doc: render related packages with md

don't generate docbook for related packages, generate markdown instead.
this could be extended further to not even generate markdown but have
mergeJSON handle all of the rendering. markdown will work fine for now
though.
This commit is contained in:
pennae 2023-01-19 00:39:17 +01:00 committed by pennae
parent fa8a594c56
commit 248e1b957d
2 changed files with 9 additions and 9 deletions

View file

@ -78,16 +78,13 @@ let
title = args.title or null;
name = args.name or (lib.concatStringsSep "." args.path);
in ''
<listitem>
<para>
<link xlink:href="https://search.nixos.org/packages?show=${name}&amp;sort=relevance&amp;query=${name}">
<literal>${lib.optionalString (title != null) "${title} aka "}pkgs.${name}</literal>
</link>
</para>
${lib.optionalString (args ? comment) "<para>${args.comment}</para>"}
</listitem>
- [`${lib.optionalString (title != null) "${title} aka "}pkgs.${name}`](
https://search.nixos.org/packages?show=${name}&sort=relevance&query=${name}
)${
lib.optionalString (args ? comment) "\n\n ${args.comment}"
}
'';
in "<itemizedlist>${lib.concatStringsSep "\n" (map (p: describe (unpack p)) packages)}</itemizedlist>";
in lib.concatMapStrings (p: describe (unpack p)) packages;
optionsNix = builtins.listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) optionsList);

View file

@ -239,6 +239,9 @@ def convertMD(options: Dict[str, Any]) -> str:
convertCode(name, option, 'example')
convertCode(name, option, 'default')
if 'relatedPackages' in option:
option['relatedPackages'] = convertString(name, option['relatedPackages'])
except Exception as e:
raise Exception(f"Failed to render option {name}: {str(e)}")