otac0n / Weave

Weave is a text templating engine for .NET that is all about attention to detail. Weave handles the tricky work of making your rendered text beautiful.
MIT License
22 stars 4 forks source link

Need a delimiter syntax for the `{{each}}` tag. #11

Closed otac0n closed 8 years ago

otac0n commented 9 years ago

Generating text like this is difficult:

new[] { 'a', 'b' }

{
    a { get; }

    b { get; }
}

It would be easier if there were a delimiter syntax:

{{each x in y}}
    {{= x }} { get; }
{{delimit}}

{{/each}}

Inline version:

new[] { {{each c in tokens}}'{{= c }}'{{delimit}}, {{/each}} }

Simply adding and removing the {{delimit}} token has the added benefit of toggling a trailing delimiter. To encourage this practice, the grammar would emit an error if it is found after the {{none}} token.

otac0n commented 8 years ago

Fixed in 9c46bb603a90d9165e5e7cccf8de239cc99bd6cf