BorisMoore / jsrender

A lightweight, powerful and highly extensible templating engine. In the browser or on Node.js, with or without jQuery.

Home Page:http://www.jsviews.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSRender strips multiple white spaces from input

mattrout92 opened this issue · comments

When I try to render a template with multiple white spaces in the input, it strips the number of spaces down to just one. It would be nice to be able to configure stopping this from happening!

E.g

Hello (4 space characters) World
renders to
Hello World

If the template has multiple adjacent white spaces, that is preserved in the output:

<script id="personTmpl" type="text/x-jsrender">Hello [4 spaces] World</script>

If you have it in data, {label: "Hello [4spaces] World"} then {{:label}} will also preserve the spaces in the output.

So I'm not sure what your scenario is where the white space is getting reduced to one space. Can you provide a sample?

@mattrout92: I didnt hear back from you. It's possible you thought JsRender was stripping white spaces, when in fact you were simply seeing the normal HTML rendering which will display

"a  b"

as if it was

"a b"

(That behavior is part of HTML and is nothing to do with JsRender.)

I will close this issue