45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
|
|
#!/usr/bin/env python3
|
||
|
|
|
||
|
|
from pathlib import Path
|
||
|
|
from ruamel.yaml import YAML
|
||
|
|
|
||
|
|
from rougail import Rougail, RougailConfig
|
||
|
|
from rougaildoc import RougailDoc
|
||
|
|
|
||
|
|
|
||
|
|
NUM="50"
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
rougailconfig = RougailConfig.copy()
|
||
|
|
# rougailconfig['dictionaries_dir'] = [f'{NUM}/dictionaries/rougail']
|
||
|
|
rougailconfig['variable_namespace'] = 'proxy'
|
||
|
|
rougailconfig['dictionaries_dir'] = ['all/proxy']
|
||
|
|
rougailconfig['extra_dictionaries'] = {'foxyproxy': ['all/foxyproxy']}
|
||
|
|
rougailconfig['tiramisu_cache'] = "cache.py"
|
||
|
|
# rougail = Rougail(rougailconfig)
|
||
|
|
# config = rougail.get_config()
|
||
|
|
# print(config.value.get())
|
||
|
|
output = 'github'
|
||
|
|
inventory = RougailDoc(rougailconfig=rougailconfig,
|
||
|
|
output=output,
|
||
|
|
title_level=2,
|
||
|
|
)
|
||
|
|
doc = inventory.formater.header()
|
||
|
|
doc += inventory.formater.title('Tutorial description files', 1)
|
||
|
|
yaml = YAML()
|
||
|
|
for r in [[rougailconfig['dictionaries_dir']], rougailconfig['extra_dictionaries'].values()]:
|
||
|
|
for dirs in r:
|
||
|
|
for d in dirs:
|
||
|
|
for f in Path(d).iterdir():
|
||
|
|
if f.name.endswith('.yml') or f.name.endswith('.yaml'):
|
||
|
|
doc += inventory.formater.title(str(f), 2)
|
||
|
|
with f.open(encoding="utf8") as file_fh:
|
||
|
|
objects = yaml.load(file_fh)
|
||
|
|
doc += inventory.formater.yaml(objects)
|
||
|
|
doc += inventory.formater.title('Generated documentation', 1)
|
||
|
|
doc += inventory.gen_doc()
|
||
|
|
doc_file = Path('README.md')
|
||
|
|
with doc_file.open('w') as docfh:
|
||
|
|
docfh.write(doc)
|