Skip to content

Commit

Permalink
feat(libdocs): create a docs.yaka summary of the library
Browse files Browse the repository at this point in the history
  • Loading branch information
JaDogg committed Mar 2, 2024
1 parent 351db8b commit f9ac244
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions compiler/scripts/libdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ def display_class(buf: Buf, fnc: dict):
def main():
structures = {}
files = []
summary_file = []
# Scan
for mod_full_filepath in glob.glob(os.path.join(LIBS_DIR, '**', '*.yaka'), recursive=True):
# print("<!-- parsing", Colors.cyan(mod_full_filepath), "-->")
Expand Down Expand Up @@ -337,32 +338,40 @@ def main():
if header in PREFIXES:
print(PREFIXES[header])
print(Colors.cyan("## ") + Colors.blue(yaksha_mod))
summary_file.append(header)
print("```yaksha")

for f in structures[yaksha_mod]["macros"]:
buf = Buf()
display_mac(buf, f)
display_comment(buf, f)
print(buf.build_color())
summary_file.append(buf.build())

for f in structures[yaksha_mod]["global_consts"]:
buf = Buf()
display_param(buf, f)
display_comment(buf, f)
print(buf.build_color())
summary_file.append(buf.build())

for f in structures[yaksha_mod]["classes"]:
buf = Buf()
display_class(buf, f)
print(buf.build_color())
summary_file.append(buf.build())

for f in structures[yaksha_mod]["functions"]:
buf = Buf()
display_function(buf, f)
print(buf.build_color())
summary_file.append(buf.build())

print("```")
print()

with open(os.path.join(OUTPUT_DIR, "docs.yaka"), "w+", encoding="utf-8") as h:
h.write("\n".join(summary_file))

if __name__ == "__main__":
main()

0 comments on commit f9ac244

Please sign in to comment.