On Monday, 14 November 2016 at 08:28:24 UTC, Sönke Ludwig wrote:
Am 03.11.2016 um 06:31 schrieb Jot:
[...]

The example above should basically work - the included template is inserted into the outer context and can access any functions or variables declared there. Alternatively, you can also define a function in an included template, which then contains/generates the appropriate dynamic content:

---
block
  include test
  - auto MyFunc(int x) { return 3*x; }
  - insertFoo(MyFunc(3));
---

test.dt:
---
- function void insertFoo(int n)
  - for (i; 0 .. n)
    p foo: #{i}
---

Thanks.

Can we include d files directly? or do we need to do this?(does .dt files import the global D context?)

Reply via email to