Friday, January 20

mustachejs

Here are some issues with the current janl implementation of mustachejs:

  1.  {{}} gets treated differently than {{ }}.  I think the treatment in the case without the inner space is inconsistent with everything else.  Feel free to replace {{ and }} here with any other pair of separators which you currently have configured.
  2. {{!comments}} do not work.
  3. Arrays are hokey.
    1. You cannot use simple arrays at all without a pragma {{%IMPLICIT-ITERATOR}} somewhere on the page.
    2. {{%}} is global in effect, which is inconsistent with, for example, the way that {{>}} works, with how {{#}} works and with how {{=}} works.  In fact, they are all inconsistent with each other in some way or another.  Why?  (But at least {{>}} and {{#}} have partial consistency between them.  ha ha ha.)
    3. We should at least have gotten a default: {{%IMPLICIT-ITERATOR iterator=to_s}} for compatibility with the original ruby.
    4. The only thing {{%}} is good for is declaring how simple arrays work, and it also provides a name/value key pair to further configure this behavior.
    5. This pragma is not documented in  http://mustache.github.com/mustache.5.html
  4. Partials are poorly documented in  http://mustache.github.com/mustache.5.html
    1. Apparently they need a view element in the current view, which has the same name as the partial.  This must be a sub-view which is used within the partial.
    2. Apparently the only thing that can be used to provide values within the partial is the contents of that sub-view.  You lose access to everything else, for no good reason that I can determine.
  5. Functions are mistreated.
    1. I should be able to implement a view (a "context") using functions -- I give my view a name and I get back the appropriate content for use within the template.  But mustachejs does not pass names to functions.  This seems like this might be a defect inherited from the original ruby mustache.
    2. Instead, we get a lame "this is for caching" implementation.  Does anyone even use that?

Some of these defects were probably inherited from the original mustache, but some of them cannot be.

This is bad enough that I don't think I care to maintain compatibility with all of mustache's quirks.

No comments:

Post a Comment