Open vuaru opened 10 years ago
It can't work exactly like this, because the form
function doesn't have access to the "contents" that get nested. The Diet compiler should probably try to detect this situation and output an error. Basically, nesting further nodes within a code line only makes sense if the code line contains an open statement, something like foreach (x; y)
, where the foreach body is missing.
A way to achieve the above goes like this:
- void form(string action, string method, scope void delegate() contents)
form(role='form', action='#{action}', method='#{method}')
- contents();
body
- form (`#`, `post`,
input(type='text', id='id', placeholder='placeholder', value='value')
input(type='submit', value='submit')
- );
Would be interesting to think about a nicer syntax for this.
The following simple .dt example illustrates the problem:
What it generates:
What it should generate: