neurocore.scaffold.render

Template rendering helpers shared by neurocore init and neurocore new.

Templates use a minimal {{ var }} substitution syntax (no real Jinja2 dependency). render_tree recursively copies a template directory, rendering every text file through the same substitution.

Attributes

Functions

render_text(→ str)

Apply {{ var }} substitutions to a string.

render_template(→ str)

Render a single template file to a string.

render_tree(→ None)

Recursively copy src_dir into dest_dir, rendering text files.

Module Contents

neurocore.scaffold.render.TEMPLATES_DIR
neurocore.scaffold.render.render_text(content: str, context: dict[str, str]) str[source]

Apply {{ var }} substitutions to a string.

neurocore.scaffold.render.render_template(template_path: pathlib.Path, context: dict[str, str]) str[source]

Render a single template file to a string.

neurocore.scaffold.render.render_tree(src_dir: pathlib.Path, dest_dir: pathlib.Path, context: dict[str, str]) None[source]

Recursively copy src_dir into dest_dir, rendering text files.

Directory names and file names are rendered too, so a template file named {{ project_name }}.py is renamed accordingly. .gitkeep files create empty directories without leaving the marker behind.