nixos/lib/make-options-doc: generate asciidoc/md in derivations
use the json file derivation we already have to also generate the asciidoc and md options docs instead of formatting the options in nix. docbook docs are already produced in derivations. the new script produce the exact same output as the old in-nix generation.
This commit is contained in:
27
nixos/lib/make-options-doc/generateCommonMark.py
Normal file
27
nixos/lib/make-options-doc/generateCommonMark.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
options = json.load(sys.stdin)
|
||||
for (name, value) in options.items():
|
||||
print('##', name.replace('<', '\\<').replace('>', '\\>'))
|
||||
print(value['description'])
|
||||
print()
|
||||
if 'type' in value:
|
||||
print('*_Type_*:')
|
||||
print(value['type'])
|
||||
print()
|
||||
print()
|
||||
if 'default' in value:
|
||||
print('*_Default_*')
|
||||
print('```')
|
||||
print(json.dumps(value['default'], ensure_ascii=False, separators=(',', ':')))
|
||||
print('```')
|
||||
print()
|
||||
print()
|
||||
if 'example' in value:
|
||||
print('*_Example_*')
|
||||
print('```')
|
||||
print(json.dumps(value['example'], ensure_ascii=False, separators=(',', ':')))
|
||||
print('```')
|
||||
print()
|
||||
print()
|
||||
Reference in New Issue
Block a user