{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/nunjucks/issues/598","repository_url":"https://api.github.com/repos/mozilla/nunjucks","labels_url":"https://api.github.com/repos/mozilla/nunjucks/issues/598/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/nunjucks/issues/598/comments","events_url":"https://api.github.com/repos/mozilla/nunjucks/issues/598/events","html_url":"https://github.com/mozilla/nunjucks/issues/598","id":119336609,"number":598,"title":"Improve documentation (and API?) for custom tags.","user":{"login":"atian25","id":227713,"avatar_url":"https://avatars.githubusercontent.com/u/227713?v=3","gravatar_id":"","url":"https://api.github.com/users/atian25","html_url":"https://github.com/atian25","followers_url":"https://api.github.com/users/atian25/followers","following_url":"https://api.github.com/users/atian25/following{/other_user}","gists_url":"https://api.github.com/users/atian25/gists{/gist_id}","starred_url":"https://api.github.com/users/atian25/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atian25/subscriptions","organizations_url":"https://api.github.com/users/atian25/orgs","repos_url":"https://api.github.com/users/atian25/repos","events_url":"https://api.github.com/users/atian25/events{/privacy}","received_events_url":"https://api.github.com/users/atian25/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mozilla/nunjucks/labels/custom-tags","name":"custom-tags","color":"006b75"},{"url":"https://api.github.com/repos/mozilla/nunjucks/labels/documentation","name":"documentation","color":"fad8c7"},{"url":"https://api.github.com/repos/mozilla/nunjucks/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-29T04:42:47Z","updated_at":"2016-04-15T18:52:01Z","closed_at":null,"body":"docs is not enough at all.\r\n\r\n```\r\n  this.tags = ['html'];\r\n\r\n  this.parse = function(parser, nodes, lexer) {\r\n    // get the tag token\r\n    var tok = parser.nextToken();\r\n\r\n    // parse the args and move after the block end. passing true\r\n    // as the second arg is required if there are no parentheses\r\n    var args = parser.parseSignature(null, true);\r\n    parser.advanceAfterBlockEnd(tok.value);\r\n\r\n    // parse the body and possibly the error block, which is optional\r\n    var body = parser.parseUntilBlocks('endhtml');\r\n\r\n    parser.advanceAfterBlockEnd();\r\n\r\n    // See above for notes about CallExtension\r\n    return new nodes.CallExtension(this, 'run', args, [body]);\r\n  };\r\n\r\n  this.run = function(context, args, body) {\r\n    console.log(args())\r\n    console.log(body())\r\n    return body();\r\n  };\r\n```\r\n\r\nhad try this as doc, but `body` is undefined, and args is the real thing to call"},"comment":{"url":"https://api.github.com/repos/mozilla/nunjucks/issues/comments/210594851","html_url":"https://github.com/mozilla/nunjucks/issues/598#issuecomment-210594851","issue_url":"https://api.github.com/repos/mozilla/nunjucks/issues/598","id":210594851,"user":{"login":"carljm","id":61586,"avatar_url":"https://avatars.githubusercontent.com/u/61586?v=3","gravatar_id":"","url":"https://api.github.com/users/carljm","html_url":"https://github.com/carljm","followers_url":"https://api.github.com/users/carljm/followers","following_url":"https://api.github.com/users/carljm/following{/other_user}","gists_url":"https://api.github.com/users/carljm/gists{/gist_id}","starred_url":"https://api.github.com/users/carljm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carljm/subscriptions","organizations_url":"https://api.github.com/users/carljm/orgs","repos_url":"https://api.github.com/users/carljm/repos","events_url":"https://api.github.com/users/carljm/events{/privacy}","received_events_url":"https://api.github.com/users/carljm/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T18:52:01Z","updated_at":"2016-04-15T18:52:01Z","body":"One use case to consider is that of #722, a custom tag that wants to inject extra context scoped to its tag body."}}