mustache / spec

The Mustache spec.
MIT License
364 stars 71 forks source link

`null` interpolation #101

Closed berdario closed 3 years ago

berdario commented 7 years ago

Which alternative should be part of the spec?

  - data: {nullkey: null }
    template: "{{nullkey}}"
    expected: ""
  - data: {nullkey: null }
    template: "{{nullkey}}"
    expected: "null"

I've seen a Mustache implementation that yields the latter, but then I checked the demo, and its behavior instead was the former

groue commented 7 years ago

What do you think?

berdario commented 7 years ago

Me?

I think that the former behavior might be less surprising, but I don't have a strong opinion.

Most importantly: I don't think that this should be left unspecified

groue commented 7 years ago

This repository has not been updated in years.

berdario commented 7 years ago

Yes, about 1year and a half, but since the Ruby implementation repository is still being worked on, and that whoever has write rights on that repo should also have them on this one, there's no excuse for this situation to persist (I know that you're not part of the organization, so I'm not blaming you)

Either they pick up the burden, or they give access to others to this repo and the website repo or, as a third alternative, if they don't want to maintain the spec anymore they should declare it an unmaintained/deprecated, give up any pretense of being a complete spec and let other standards flourish

Ok, I strikethrough'ed the text since I'm afraid it could've come off as a bit bitter... also I found this old blog post: http://writing.jan.io/mustache-2.0.html So the idea of a Mustache2 is not new, and Handlebars apparently never went anywhere (outside of javascript and few languages)

I guess that I should get used to the idea that good and complete standards are an exception, not the rule

groue commented 7 years ago

Yes, this is very frustrating. You may be interested in https://github.com/groue/GRMustacheSpec, an extended Mustache test suite (which addresses the rendering of null)

Danappelxx commented 3 years ago

Reviving! We have a couple maintainers now... Personally I think rendering "null" is totally incorrect. Would appreciate a pull request adding this to the spec.

jgonggrijp commented 3 years ago

I agree with the empty string, also for consistency with context misses:

https://github.com/mustache/spec/blob/e6b685a139b5e380b11b88fbbe9d5e322d33505d/specs/interpolation.yml#L106-L122

I might submit a PR but I'm very busy, so if somebody else finds the time, please go ahead.