olado/doT

control instructions should not be counted as white space

pke opened this issue · 2 comments

pke commented

Given this template, it should render a CSV output with no empty lines

host,pin,subject
{{~ it :e }}
{{=e.host}},{{=e.hash}},{{=e.subject.CN}}
{{~}}

However, the output contains an empty line after the header and after each of the arrays items.
Currently this template has to be used to get a proper formatted CSV output:

host,pin,subject{{~ it :e }}
{{=e.host}},{{=e.hash}},{{=e.subject.CN}}{{~}}

which is rather ugly.
Will this be fixed in V2?

This looks like expected behavior to me. The templating engine begins immediately after the delimiter, so the first character it encounters is a newline. The newline will therefore be rendered by the iterator. This is what the engine actually sees, where \n indicates a newline character:

host,pin,subject
{{~ it :e }}\n
{{=e.host}},{{=e.hash}},{{=e.subject.CN}}\n
{{~}}

Hi, try my fork xdot, I have fixed it