Skip to content

Commit f9ac244

Browse files
committed
feat(libdocs): create a docs.yaka summary of the library
1 parent 351db8b commit f9ac244

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compiler/scripts/libdocs.py

+9
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ def display_class(buf: Buf, fnc: dict):
308308
def main():
309309
structures = {}
310310
files = []
311+
summary_file = []
311312
# Scan
312313
for mod_full_filepath in glob.glob(os.path.join(LIBS_DIR, '**', '*.yaka'), recursive=True):
313314
# print("<!-- parsing", Colors.cyan(mod_full_filepath), "-->")
@@ -337,32 +338,40 @@ def main():
337338
if header in PREFIXES:
338339
print(PREFIXES[header])
339340
print(Colors.cyan("## ") + Colors.blue(yaksha_mod))
341+
summary_file.append(header)
340342
print("```yaksha")
341343

342344
for f in structures[yaksha_mod]["macros"]:
343345
buf = Buf()
344346
display_mac(buf, f)
345347
display_comment(buf, f)
346348
print(buf.build_color())
349+
summary_file.append(buf.build())
347350

348351
for f in structures[yaksha_mod]["global_consts"]:
349352
buf = Buf()
350353
display_param(buf, f)
351354
display_comment(buf, f)
352355
print(buf.build_color())
356+
summary_file.append(buf.build())
353357

354358
for f in structures[yaksha_mod]["classes"]:
355359
buf = Buf()
356360
display_class(buf, f)
357361
print(buf.build_color())
362+
summary_file.append(buf.build())
358363

359364
for f in structures[yaksha_mod]["functions"]:
360365
buf = Buf()
361366
display_function(buf, f)
362367
print(buf.build_color())
368+
summary_file.append(buf.build())
363369

364370
print("```")
365371
print()
366372

373+
with open(os.path.join(OUTPUT_DIR, "docs.yaka"), "w+", encoding="utf-8") as h:
374+
h.write("\n".join(summary_file))
375+
367376
if __name__ == "__main__":
368377
main()

0 commit comments

Comments
 (0)