mmontone/ten

Feature request: Control insertion of newlines

Opened this issue · 5 comments

Hi

It would be really helpful if it was possible to control how the }} and %} delimiters inserted newlines, possibly like Jinja does using {%- and -%}. I am using Ten for text emails (ie no HTML) and controlling newlines with actual newlines make the template very difficult to read.

I'm looking, but note that there's :output-whitespace option (explained in the README).

I was not aware of the :output-whitespace. I will try it.

The :output-whitespace works much better. The code is readable again.

The downside is that inside control structures like loop all whitespace between {{ and }} is now ignored. E.g.

{% loop %}
{{ var1 }}       {{ var2 }}
{% end %}

In above snipped var1 and var2 will be printed without any space between them. I now use format nil "~A ~A" var1 var2 to get the desired output. Don't know if this is the best way...

Mm... I see. Looks like you would need finer grained control ...

I'd have to think what would be best. If "complicate" the library with new tags, or what ..

with-output-whitespace gives you some local control of whitespace now. Have a look at the commit.