Code Monkey home page Code Monkey logo

magnum's People

Contributors

fletcher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

cluoma

magnum's Issues

Displaying section if array exists, *without* iterating each element of array.

Given JSON:

{
	"images": [{
			"src": "http://www.fpoimg.com/20x20"
		},
		{
			"src": "http://www.fpoimg.com/30x30"
		},
		{
			"src": "http://www.fpoimg.com/40x40"
		}
	],
	"anEmptyArray": []
}

and template:

{{#images.length}}
    <h3>The images: this should only be rendered once.</h3>
    <ul>
        {{#images}}
            <li><img src="{{src}}"/></li>
        {{/images}}
    </ul>
{{/images.length}}
{{#anEmptyArray.length}}
    <h3>The empty array: this should NOT be rendered.</h3>
{{/anEmptyArray.length}}

Some Mustache implementations (including the Demo here return:

<h3>The images: this should only be rendered once.</h3>
<ul>
<li><img src="http:&#x2F;&#x2F;www.fpoimg.com&#x2F;20x20"/></li>
<li><img src="http:&#x2F;&#x2F;www.fpoimg.com&#x2F;30x30"/></li>
<li><img src="http:&#x2F;&#x2F;www.fpoimg.com&#x2F;40x40"/></li>
</ul>

The {{#images.length}} tag does not appear to be part of the Mustache spec. For that matter, neither does {{#images.0}} which could be used to refer to the first element of the array.

  • This would seem to be a useful function.
  • It is not part of the spec
  • The spec appears to be dead (no commits in 4 years, no meaningful issue closure in 4 years)
  • The ruby implementation appears to have had at least some activity within the last year, and the website within the last month.

It seems that we are in another "Markdown" scenario where the initial parent project is at least partially dead, whereas one or more child projects are still alive (including this one.) Which is unfortunate.

I will probably end up implementing these features, as they seem useful to me, and do not seem to violate the logic-less philosophy as demonstrated by other core features. But I don't have time at the moment, so this is a reminder to myself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.