{"action":"created","issue":{"url":"https://api.github.com/repos/zordius/lightncandy/issues/127","labels_url":"https://api.github.com/repos/zordius/lightncandy/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/zordius/lightncandy/issues/127/comments","events_url":"https://api.github.com/repos/zordius/lightncandy/issues/127/events","html_url":"https://github.com/zordius/lightncandy/issues/127","id":55011891,"number":127,"title":"custom block helper does not create new scope","user":{"login":"ssnau","id":738660,"avatar_url":"https://avatars.githubusercontent.com/u/738660?v=3","gravatar_id":"","url":"https://api.github.com/users/ssnau","html_url":"https://github.com/ssnau","followers_url":"https://api.github.com/users/ssnau/followers","following_url":"https://api.github.com/users/ssnau/following{/other_user}","gists_url":"https://api.github.com/users/ssnau/gists{/gist_id}","starred_url":"https://api.github.com/users/ssnau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssnau/subscriptions","organizations_url":"https://api.github.com/users/ssnau/orgs","repos_url":"https://api.github.com/users/ssnau/repos","events_url":"https://api.github.com/users/ssnau/events{/privacy}","received_events_url":"https://api.github.com/users/ssnau/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/zordius/lightncandy/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-21T12:24:44Z","updated_at":"2015-01-22T11:14:11Z","closed_at":null,"body":"Hi Zordius,\r\n\r\nI found a problem about custom block helper. \r\n\r\nFor a common #if helper, it will create a new scope, means:\r\n\r\n```\r\ndata: ['name' => 'john', 'array' => [1,2,3]]\r\n\r\n{{#each array}}\r\n    {{#if true}}\r\n         {{name}} #visiting current scope, ouput blank\r\n         {{../name}} # visiting parent scope, output blank\r\n         {{../../name}}  #up to root scope, output \"john\"\r\n    {{/if}}\r\n{{/each}}\r\n```\r\n\r\nIt is fine!\r\n\r\nBut for a custom block helper with nothing pass for its options['fn']，it will not create a new scope.\r\n\r\n```\r\ndata: ['name' => 'john', 'array' => [1,2,3]]\r\n\r\n{{#each array}}\r\n    {{#custom true}}\r\n         {{name}} #visiting current scope, ouput blank\r\n         {{../name}} # visiting parent scope, output \"john\"\r\n    {{/custom}}\r\n{{/each}}\r\n```\r\n\r\nHowever, it is not coordinate with handlebars, which always applies a new scope for a block helper. It means you have to use `{{../../name}}` to visit the properties in the second example with Handlebars.\r\n\r\nHow do you think of this problem? Do you think it worth to fix to make it coordinate with Handlebars? Since we may write some template code for both server and client side and this problem may stop this idea.\r\n\r\nThanks,\r\nssnau"},"comment":{"url":"https://api.github.com/repos/zordius/lightncandy/issues/comments/71005604","html_url":"https://github.com/zordius/lightncandy/issues/127#issuecomment-71005604","issue_url":"https://api.github.com/repos/zordius/lightncandy/issues/127","id":71005604,"user":{"login":"zordius","id":1201409,"avatar_url":"https://avatars.githubusercontent.com/u/1201409?v=3","gravatar_id":"","url":"https://api.github.com/users/zordius","html_url":"https://github.com/zordius","followers_url":"https://api.github.com/users/zordius/followers","following_url":"https://api.github.com/users/zordius/following{/other_user}","gists_url":"https://api.github.com/users/zordius/gists{/gist_id}","starred_url":"https://api.github.com/users/zordius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zordius/subscriptions","organizations_url":"https://api.github.com/users/zordius/orgs","repos_url":"https://api.github.com/users/zordius/repos","events_url":"https://api.github.com/users/zordius/events{/privacy}","received_events_url":"https://api.github.com/users/zordius/received_events","type":"User","site_admin":false},"created_at":"2015-01-22T11:14:11Z","updated_at":"2015-01-22T11:14:11Z","body":"confirmed as a bug, will fix it later."}}