nixos-render-docs: don't render empty descriptions at all

This commit is contained in:
pennae 2023-02-01 21:24:58 +01:00 committed by pennae
parent 11daebd2d9
commit 32136b1b01

View file

@ -107,9 +107,9 @@ class BaseConverter(Converter):
def _render_description(self, desc: str | dict[str, str]) -> list[str]:
if isinstance(desc, str) and self._markdown_by_default:
return [ self._render(desc) ]
return [ self._render(desc) ] if desc else []
elif isinstance(desc, dict) and desc.get('_type') == 'mdDoc':
return [ self._render(desc['text']) ]
return [ self._render(desc['text']) ] if desc['text'] else []
else:
raise Exception("description has unrecognized type", desc)