Skip to content

Commit

Permalink
auto-generator.py: Add comments about boilerplate stripping
Browse files Browse the repository at this point in the history
  • Loading branch information
ideoforms committed Jan 8, 2024
1 parent e90199f commit 0c80c9e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion auxiliary/scripts/auto-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,16 @@ def generate_node_library(node_classes):
if len(example_scripts):
fd.write(f"### Examples\n\n")
for example_script in example_scripts:
#--------------------------------------------------------------------------------
# For each example script:
# - read the code
# - strip any leading boilerplate (up till the creation of the AudioGraph)
# - strip any trailing boilerplate (graph.wait())
#--------------------------------------------------------------------------------
example_code = open(example_script, "r").read()
example_code = re.sub(r".*graph = AudioGraph\(\)\n", "", example_code, flags=re.DOTALL)
example_code = re.sub(r"graph.wait\(\).*", "", example_code, flags=re.DOTALL)
fd.write(f"```python\n")
# fd.write('{%% include-markdown "./%s" comments=false %%}\n' % example_script)
fd.write(example_code)
fd.write(f"\n```\n\n")

Expand Down

0 comments on commit 0c80c9e

Please sign in to comment.