{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/1786d63e058f7ab194f5e0dfa24ca19b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"1786d63e058f7ab194f5e0dfa24ca19b","url":"https://api.github.com/users/jtreminio","login":"jtreminio","id":589398},"assignee":null,"updated_at":"2011-11-15T06:33:41Z","labels":[],"closed_at":null,"comments":0,"url":"https://api.github.com/repos/defunkt/mustache/issues/118","body":"Would like to propose that a NOT EMPTY section check be added.\r\n\r\nCurrently this checks if empty:\r\n\r\n`{{^empty_string}}foo{{/empty_string}}`\r\n\r\nBut if we want to check if element is NOT empty, we have no other choice than using `{{#check}}foo{{/check}}`, but this has the side effect of iterating through the element if it's an array.\r\n\r\nAn example where this would be an issue would be in an HTML menu.\r\n\r\nHere's what we want HTML to look like:\r\n\r\n````html\r\n<a href=\"/home\">Home</a>\r\n\r\n<a href=\"/posts\">Posts</a>\r\n    <ul>\r\n        <li><a href=\"/posts/all\">All Posts</a></li>\r\n        <li><a href=\"/posts/add\">Add New</a></li>\r\n    </ul>\r\n\r\n<a href=\"/posts\">Pages</a>\r\n    <ul>\r\n        <li><a href=\"/pages/all\">All Pages</a></li>\r\n        <li><a href=\"/pages/add\">Add New</a></li>\r\n    </ul>\r\n````\r\n\r\nYou can't currently test if there are sublinks to each section without iterating over the results, so you can't print out `<ul>` and `</ul>` a single time - it would print out as many times as there are links in the array that contains the sublinks.\r\n\r\nUsing a NOT EMPTY check would alleviate this problem:\r\n\r\n````\r\n{{@sublinks}}\r\n    <ul>\r\n        {{#sublinks}}<li><a href=\"/{{base}}/{{slug}}\">{{name}}</a></li>{{/sublinks}}\r\n    </ul>\r\n{{/sublinks}}\r\n\r\nI've extended the PHP Mustache class and it's exactly 7 lines of code. I don't know Ruby but I can't imagine it being any different.\r\n\r\nThanks!","html_url":"https://github.com/defunkt/mustache/issues/118","title":"Add NOT empty check","number":118,"id":2240637,"created_at":"2011-11-15T06:33:41Z"},"action":"opened"}