Skip to content

Commit 2872fbe

Browse files
committed
build json as part of the docs
1 parent 944cb79 commit 2872fbe

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎doc/conf.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,21 @@
142142
'python': ('https://docs.python.org/3', None),
143143
'pylatexenc': ('https://pylatexenc.readthedocs.io/en/latest/', None)
144144
}
145+
146+
147+
# -- Generate FLM config JSON schema into _static/ at build time -----------
148+
149+
def _generate_config_json_schema(app, exception):
150+
if exception:
151+
return
152+
import json
153+
from flm.main.main import Main
154+
a = Main(flm_content='', _no_default_stdin=True)
155+
run_object = a.make_run_object()
156+
schema = run_object.get_config_json_schema()
157+
outpath = os.path.join(app.outdir, 'flm-config-json-schema.json')
158+
with open(outpath, 'w') as f:
159+
json.dump(schema, f, indent=2)
160+
161+
def setup(app):
162+
app.connect('build-finished', _generate_config_json_schema)

0 commit comments

Comments
 (0)