diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-04-20 13:43:01 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-04-20 13:43:01 +0200 |
| commit | 0686b40f979f4607b3fd8cca21c463e98f617666 (patch) | |
| tree | 355e8a7bfd4b37510d05370876a9d8cedfdcd5d7 /example | |
| parent | ba561ebd063b391013b6c9c1fcc9b1838dd422e6 (diff) | |
implement builder and instance
Diffstat (limited to 'example')
| -rw-r--r-- | example/build.lua | 9 | ||||
| -rw-r--r-- | example/test.py | 39 |
2 files changed, 48 insertions, 0 deletions
diff --git a/example/build.lua b/example/build.lua new file mode 100644 index 0000000..47cfbda --- /dev/null +++ b/example/build.lua @@ -0,0 +1,9 @@ + +local template = Template:new() + +template:add_file("./test.py", { + module = "a_module_that_is_different", + name = template:option('name') +}) + +return template diff --git a/example/test.py b/example/test.py new file mode 100644 index 0000000..20c1c7e --- /dev/null +++ b/example/test.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +# This module is called @{name()} + +import @{module} + +print("@{function() + return "Hello World" +end}") + +print("@{function() + local a = { "asdf", "1234" } + return a[1] +end}") + +print(@{function() + local a = { "asdf", "1234" } -- { + return a[2] +end}) + +print("@{function() + local a = "asdf{asdf" + return a:sub(1) +end}") + +print("@{function() + local a = "asdf" + --[[ + some comment } + --]] + return a +end}") + +print("@{function() + local a = [[ + some comment } + ]] + return a:sub(2, 8) +end}") |