xxgreg / mustache

Mustache template Dart library
BSD 2-Clause "Simplified" License
57 stars 59 forks source link

renderString shrinks multiple newlines to just one #24

Closed MikeMitterer closed 8 years ago

MikeMitterer commented 8 years ago

I am not 100% sure but almost... if there is more than on newline renderString strips out the others

So

First line

second line

becomes

First line
second line
xxgreg commented 8 years ago

Could you give me a full example.

The mustache has a bunch of tricky rules around whitespace.

Such as:

  - name: Standalone Lines
    desc: Standalone lines should be removed from the template.
    data: { boolean: true }
    template: |
      | This Is
      {{#boolean}}
      |
      {{/boolean}}
      | A Line
    expected: |
      | This Is
      |
      | A Line

There are probably some bugs around handling these.

xxgreg commented 8 years ago

I noticed someone else has had a crack at this problem. Thanks for the test case John ;)

https://github.com/johnpryan/mustache/commit/04c6201041573e0e62bda9736412512599d0c8ec

I've pushed a fix.

@MikeMitterer could you please see if this solves the problems you've seen.