groue / GRMustache.swift

Flexible Mustache templates for Swift
http://mustache.github.com/
MIT License
594 stars 155 forks source link

Mustache tags on new lines are replaced with empty space #77

Open AdamEisfeld opened 3 years ago

AdamEisfeld commented 3 years ago

First off, great library!

I might be missing some obvious syntax here, but given the following example:

{{#someOptionalValue}}
The value is {{someOptionalValue}}
{{/someOptionalValue}}

The output we get (assuming someOptionalValue is "Hello, World") is:


The value is Hello, World

Is there a way to modify the tags, such that the newlines before / after "The value is Hello, World" are removed? Eg:

The value is Hello, World

Currently it seems I can only achieve this by putting everything on one line:

{{#someOptionalValue}}The value is {{someOptionalValue}}{{/someOptionalValue}}

I have seem some references to Handlebars using a tilde to accomplish this, eg:

{{~#someOptionalValue~}}
The value is {{someOptionalValue}}
{{/someOptionalValue}}

But in attempting to do this with this repository's Mustache implementation, I get an error "Unmatched closing tag".

Thanks,

groue commented 3 years ago

Hello @AdamEisfeld,

GRMustache.swift is now maintained by @fumito-ito. Let's wait for his answer. Meanwhile, a pull request that adds the described behavior, while respecting the Mustache Spec will be gladly reviewed.

levigroker commented 8 months ago

I'm seeing this, or something similar, today... in 2023. Any updates?