olado / doT

The fastest + concise javascript template engine for nodejs and browsers. Partials, custom delimiters and more.
Other
5.01k stars 1.02k forks source link

Fix {{!value}} out when the value is number 0 #274

Closed keel closed 4 years ago

keel commented 6 years ago

{{!value}} out '' when the value is number 0 or boolean false, but{{=value}} is right, so I think this should be fixed.

keel commented 6 years ago

@epoberezkin I think templet engine does not expects the input value is always string, just like jsp, <%=new Integer(0) %> it will out "0" not "" , and {{=does the right output ,it will be '0', {{! should be the same, and also there're similar issues before, like #170 , #178, #183 . So I think it should be fixed.

The tests failed last time because the travis itself, anyway I send a new PR in v2.0.0.

epoberezkin commented 4 years ago

2.0 will support custom encoders, non-strings will be interpolated as is.