GRMustache.swift icon indicating copy to clipboard operation
GRMustache.swift copied to clipboard

Mustache tags on new lines are replaced with empty space

Open AdamEisfeld opened this issue 4 years ago • 2 comments

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,

  • Adam

AdamEisfeld avatar Jan 17 '21 22:01 AdamEisfeld

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.

groue avatar Jan 20 '21 08:01 groue

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

levigroker avatar Dec 14 '23 16:12 levigroker