{"action":"created","issue":{"url":"https://api.github.com/repos/daokoder/dao-modules/issues/77","labels_url":"https://api.github.com/repos/daokoder/dao-modules/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/daokoder/dao-modules/issues/77/comments","events_url":"https://api.github.com/repos/daokoder/dao-modules/issues/77/events","html_url":"https://github.com/daokoder/dao-modules/issues/77","id":108855175,"number":77,"title":"Enhancement: allow nested contexts in web.html","user":{"login":"dumblob","id":2451044,"avatar_url":"https://avatars.githubusercontent.com/u/2451044?v=3","gravatar_id":"","url":"https://api.github.com/users/dumblob","html_url":"https://github.com/dumblob","followers_url":"https://api.github.com/users/dumblob/followers","following_url":"https://api.github.com/users/dumblob/following{/other_user}","gists_url":"https://api.github.com/users/dumblob/gists{/gist_id}","starred_url":"https://api.github.com/users/dumblob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dumblob/subscriptions","organizations_url":"https://api.github.com/users/dumblob/orgs","repos_url":"https://api.github.com/users/dumblob/repos","events_url":"https://api.github.com/users/dumblob/events{/privacy}","received_events_url":"https://api.github.com/users/dumblob/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-09-29T12:02:54Z","updated_at":"2015-10-01T09:06:31Z","closed_at":"2015-09-29T15:13:08Z","body":"I've reconsidered the requirement of having nested contexts and even though we already discussed this issue somewhere, I'm absolutely sure, supporting nested contexts is a must.\r\n\r\nBecause of the nature of the web.html module, it's hard to work with similar subtrees if one doesn't want to duplicate code. For this purpose, anonymous routines are a well-fitting solution, but they can't be used, because calling `fragment(){}` in an existing context is not supported. Consider the following simple example, where I can't think of any better abstraction.\r\n\r\n~~~~ruby\r\ndocument {\r\n  my_context = ...\r\n  ...  # some long document stuff changing my_context\r\n  put_one_x = routine(x) => string {\r\n    return fragment {\r\n      div(id=x.id) {\r\n        anchor(href=x.uri.img) {x.uri.lbl}\r\n      ...  # and lots of other stuff\r\n      }\r\n    }\r\n  }\r\n  # get_list_of_x() returns a long list of tuples\r\n  for (x in get_list_of_x(my_context)) {\r\n    text(put_one_x(x))\r\n  }\r\n}\r\n~~~~"},"comment":{"url":"https://api.github.com/repos/daokoder/dao-modules/issues/comments/144663311","html_url":"https://github.com/daokoder/dao-modules/issues/77#issuecomment-144663311","issue_url":"https://api.github.com/repos/daokoder/dao-modules/issues/77","id":144663311,"user":{"login":"dumblob","id":2451044,"avatar_url":"https://avatars.githubusercontent.com/u/2451044?v=3","gravatar_id":"","url":"https://api.github.com/users/dumblob","html_url":"https://github.com/dumblob","followers_url":"https://api.github.com/users/dumblob/followers","following_url":"https://api.github.com/users/dumblob/following{/other_user}","gists_url":"https://api.github.com/users/dumblob/gists{/gist_id}","starred_url":"https://api.github.com/users/dumblob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dumblob/subscriptions","organizations_url":"https://api.github.com/users/dumblob/orgs","repos_url":"https://api.github.com/users/dumblob/repos","events_url":"https://api.github.com/users/dumblob/events{/privacy}","received_events_url":"https://api.github.com/users/dumblob/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T09:06:31Z","updated_at":"2015-10-01T09:06:31Z","body":">generate multiple documents simultaneously in which case you can just spawn more tasklets\r\n\r\nI'll do as generating multiple documents simultaneously is what I actually want to achieve."}}