{"action":"created","comment":{"url":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/comments/117973398","pull_request_review_id":39721937,"id":117973398,"diff_hunk":"@@ -0,0 +1,30 @@\n+require 'ox'\n+\n+module Ratchet\n+  class HtmlParser\n+    def call(html)\n+      document = Ox.parse(html)\n+      parse(document)\n+    end\n+\n+    private\n+\n+    def parse(element)\n+      if element.is_a?(Ox::Element)\n+        parse_element(element)\n+      else\n+        [:static, element]\n+      end\n+    end\n+\n+    def parse_element(element)\n+      [","path":"lib/ratchet/html_parser.rb","position":null,"original_position":21,"commit_id":"095aa1ef43fc1dde57afda6a64b1ada861bc768c","original_commit_id":"24c030e24d0331576d0b5a2705b05709baa8688a","user":{"login":"iamvery","id":79619,"avatar_url":"https://avatars1.githubusercontent.com/u/79619?v=3","gravatar_id":"","url":"https://api.github.com/users/iamvery","html_url":"https://github.com/iamvery","followers_url":"https://api.github.com/users/iamvery/followers","following_url":"https://api.github.com/users/iamvery/following{/other_user}","gists_url":"https://api.github.com/users/iamvery/gists{/gist_id}","starred_url":"https://api.github.com/users/iamvery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamvery/subscriptions","organizations_url":"https://api.github.com/users/iamvery/orgs","repos_url":"https://api.github.com/users/iamvery/repos","events_url":"https://api.github.com/users/iamvery/events{/privacy}","received_events_url":"https://api.github.com/users/iamvery/received_events","type":"User","site_admin":false},"body":"The array syntax is a temple thing. They call these \"abstractions\". There are a number of existing ones that temple already knows how to deal with (https://github.com/judofyr/temple/blob/master/EXPRESSIONS.md).\r\n\r\nBasically this is an abstract syntax tree. So from a high level, with temple, you:\r\n1. Parse a temple into an initial abstraction. In my experience, this is often something specific to your domain. So in the case of Ratchet, we have \"nuts\" and \"bolts\" 😆 .\r\n2. You pipe the parsed abstractions through a series of filters (in temple terminology). These are effectively functional transformations.\r\n3. Finally, you run it through one final transformation called a generator. Temple comes with a few of these, but essentially this is the thing that concatenates strings.\r\n\r\nNote: each of these: parser, filters, and generators are more generally referred to as \"compilers\" in temple terminology.\r\n\r\nIt's all quite nice! In fact it feels a little more complete than the Elixir equivalents I've worked with already. Too bad Ruby will never handle strings as fast as Elixir 😉 ","created_at":"2017-05-23T12:12:49Z","updated_at":"2017-05-23T12:12:49Z","html_url":"https://github.com/iamvery/ratchet-ruby/pull/2#discussion_r117973398","pull_request_url":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/comments/117973398"},"html":{"href":"https://github.com/iamvery/ratchet-ruby/pull/2#discussion_r117973398"},"pull_request":{"href":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/2","id":121581790,"html_url":"https://github.com/iamvery/ratchet-ruby/pull/2","diff_url":"https://github.com/iamvery/ratchet-ruby/pull/2.diff","patch_url":"https://github.com/iamvery/ratchet-ruby/pull/2.patch","issue_url":"https://api.github.com/repos/iamvery/ratchet-ruby/issues/2","number":2,"state":"closed","locked":false,"title":"Parsing + Transformation","user":{"login":"iamvery","id":79619,"avatar_url":"https://avatars1.githubusercontent.com/u/79619?v=3","gravatar_id":"","url":"https://api.github.com/users/iamvery","html_url":"https://github.com/iamvery","followers_url":"https://api.github.com/users/iamvery/followers","following_url":"https://api.github.com/users/iamvery/following{/other_user}","gists_url":"https://api.github.com/users/iamvery/gists{/gist_id}","starred_url":"https://api.github.com/users/iamvery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamvery/subscriptions","organizations_url":"https://api.github.com/users/iamvery/orgs","repos_url":"https://api.github.com/users/iamvery/repos","events_url":"https://api.github.com/users/iamvery/events{/privacy}","received_events_url":"https://api.github.com/users/iamvery/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-05-19T20:59:50Z","updated_at":"2017-05-23T12:12:49Z","closed_at":"2017-05-21T21:04:17Z","merged_at":"2017-05-21T21:04:17Z","merge_commit_sha":"429b030a2c220e05b4c837fae611e9732f82413c","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/2/commits","review_comments_url":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/2/comments","review_comment_url":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iamvery/ratchet-ruby/issues/2/comments","statuses_url":"https://api.github.com/repos/iamvery/ratchet-ruby/statuses/095aa1ef43fc1dde57afda6a64b1ada861bc768c","head":{"label":"iamvery:html-parser","ref":"html-parser","sha":"095aa1ef43fc1dde57afda6a64b1ada861bc768c","user":{"login":"iamvery","id":79619,"avatar_url":"https://avatars1.githubusercontent.com/u/79619?v=3","gravatar_id":"","url":"https://api.github.com/users/iamvery","html_url":"https://github.com/iamvery","followers_url":"https://api.github.com/users/iamvery/followers","following_url":"https://api.github.com/users/iamvery/following{/other_user}","gists_url":"https://api.github.com/users/iamvery/gists{/gist_id}","starred_url":"https://api.github.com/users/iamvery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamvery/subscriptions","organizations_url":"https://api.github.com/users/iamvery/orgs","repos_url":"https://api.github.com/users/iamvery/repos","events_url":"https://api.github.com/users/iamvery/events{/privacy}","received_events_url":"https://api.github.com/users/iamvery/received_events","type":"User","site_admin":false},"repo":{"id":91711527,"name":"ratchet-ruby","full_name":"iamvery/ratchet-ruby","owner":{"login":"iamvery","id":79619,"avatar_url":"https://avatars1.githubusercontent.com/u/79619?v=3","gravatar_id":"","url":"https://api.github.com/users/iamvery","html_url":"https://github.com/iamvery","followers_url":"https://api.github.com/users/iamvery/followers","following_url":"https://api.github.com/users/iamvery/following{/other_user}","gists_url":"https://api.github.com/users/iamvery/gists{/gist_id}","starred_url":"https://api.github.com/users/iamvery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamvery/subscriptions","organizations_url":"https://api.github.com/users/iamvery/orgs","repos_url":"https://api.github.com/users/iamvery/repos","events_url":"https://api.github.com/users/iamvery/events{/privacy}","received_events_url":"https://api.github.com/users/iamvery/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iamvery/ratchet-ruby","description":"Plain HTML Templates","fork":false,"url":"https://api.github.com/repos/iamvery/ratchet-ruby","forks_url":"https://api.github.com/repos/iamvery/ratchet-ruby/forks","keys_url":"https://api.github.com/repos/iamvery/ratchet-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iamvery/ratchet-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iamvery/ratchet-ruby/teams","hooks_url":"https://api.github.com/repos/iamvery/ratchet-ruby/hooks","issue_events_url":"https://api.github.com/repos/iamvery/ratchet-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/iamvery/ratchet-ruby/events","assignees_url":"https://api.github.com/repos/iamvery/ratchet-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/iamvery/ratchet-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/iamvery/ratchet-ruby/tags","blobs_url":"https://api.github.com/repos/iamvery/ratchet-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iamvery/ratchet-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iamvery/ratchet-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/iamvery/ratchet-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iamvery/ratchet-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/iamvery/ratchet-ruby/languages","stargazers_url":"https://api.github.com/repos/iamvery/ratchet-ruby/stargazers","contributors_url":"https://api.github.com/repos/iamvery/ratchet-ruby/contributors","subscribers_url":"https://api.github.com/repos/iamvery/ratchet-ruby/subscribers","subscription_url":"https://api.github.com/repos/iamvery/ratchet-ruby/subscription","commits_url":"https://api.github.com/repos/iamvery/ratchet-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/iamvery/ratchet-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/iamvery/ratchet-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/iamvery/ratchet-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/iamvery/ratchet-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/iamvery/ratchet-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iamvery/ratchet-ruby/merges","archive_url":"https://api.github.com/repos/iamvery/ratchet-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iamvery/ratchet-ruby/downloads","issues_url":"https://api.github.com/repos/iamvery/ratchet-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/iamvery/ratchet-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/iamvery/ratchet-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iamvery/ratchet-ruby/labels{/name}","releases_url":"https://api.github.com/repos/iamvery/ratchet-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/iamvery/ratchet-ruby/deployments","created_at":"2017-05-18T15:48:26Z","updated_at":"2017-05-18T15:48:48Z","pushed_at":"2017-05-23T03:24:54Z","git_url":"git://github.com/iamvery/ratchet-ruby.git","ssh_url":"git@github.com:iamvery/ratchet-ruby.git","clone_url":"https://github.com/iamvery/ratchet-ruby.git","svn_url":"https://github.com/iamvery/ratchet-ruby","homepage":"https://github.com/iamvery/ratchet","size":26,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"iamvery:master","ref":"master","sha":"ebb69d97eba6f5ea2a8256d6993a2e99d7a42b58","user":{"login":"iamvery","id":79619,"avatar_url":"https://avatars1.githubusercontent.com/u/79619?v=3","gravatar_id":"","url":"https://api.github.com/users/iamvery","html_url":"https://github.com/iamvery","followers_url":"https://api.github.com/users/iamvery/followers","following_url":"https://api.github.com/users/iamvery/following{/other_user}","gists_url":"https://api.github.com/users/iamvery/gists{/gist_id}","starred_url":"https://api.github.com/users/iamvery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamvery/subscriptions","organizations_url":"https://api.github.com/users/iamvery/orgs","repos_url":"https://api.github.com/users/iamvery/repos","events_url":"https://api.github.com/users/iamvery/events{/privacy}","received_events_url":"https://api.github.com/users/iamvery/received_events","type":"User","site_admin":false},"repo":{"id":91711527,"name":"ratchet-ruby","full_name":"iamvery/ratchet-ruby","owner":{"login":"iamvery","id":79619,"avatar_url":"https://avatars1.githubusercontent.com/u/79619?v=3","gravatar_id":"","url":"https://api.github.com/users/iamvery","html_url":"https://github.com/iamvery","followers_url":"https://api.github.com/users/iamvery/followers","following_url":"https://api.github.com/users/iamvery/following{/other_user}","gists_url":"https://api.github.com/users/iamvery/gists{/gist_id}","starred_url":"https://api.github.com/users/iamvery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamvery/subscriptions","organizations_url":"https://api.github.com/users/iamvery/orgs","repos_url":"https://api.github.com/users/iamvery/repos","events_url":"https://api.github.com/users/iamvery/events{/privacy}","received_events_url":"https://api.github.com/users/iamvery/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iamvery/ratchet-ruby","description":"Plain HTML Templates","fork":false,"url":"https://api.github.com/repos/iamvery/ratchet-ruby","forks_url":"https://api.github.com/repos/iamvery/ratchet-ruby/forks","keys_url":"https://api.github.com/repos/iamvery/ratchet-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iamvery/ratchet-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iamvery/ratchet-ruby/teams","hooks_url":"https://api.github.com/repos/iamvery/ratchet-ruby/hooks","issue_events_url":"https://api.github.com/repos/iamvery/ratchet-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/iamvery/ratchet-ruby/events","assignees_url":"https://api.github.com/repos/iamvery/ratchet-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/iamvery/ratchet-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/iamvery/ratchet-ruby/tags","blobs_url":"https://api.github.com/repos/iamvery/ratchet-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iamvery/ratchet-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iamvery/ratchet-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/iamvery/ratchet-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iamvery/ratchet-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/iamvery/ratchet-ruby/languages","stargazers_url":"https://api.github.com/repos/iamvery/ratchet-ruby/stargazers","contributors_url":"https://api.github.com/repos/iamvery/ratchet-ruby/contributors","subscribers_url":"https://api.github.com/repos/iamvery/ratchet-ruby/subscribers","subscription_url":"https://api.github.com/repos/iamvery/ratchet-ruby/subscription","commits_url":"https://api.github.com/repos/iamvery/ratchet-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/iamvery/ratchet-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/iamvery/ratchet-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/iamvery/ratchet-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/iamvery/ratchet-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/iamvery/ratchet-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iamvery/ratchet-ruby/merges","archive_url":"https://api.github.com/repos/iamvery/ratchet-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iamvery/ratchet-ruby/downloads","issues_url":"https://api.github.com/repos/iamvery/ratchet-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/iamvery/ratchet-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/iamvery/ratchet-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iamvery/ratchet-ruby/labels{/name}","releases_url":"https://api.github.com/repos/iamvery/ratchet-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/iamvery/ratchet-ruby/deployments","created_at":"2017-05-18T15:48:26Z","updated_at":"2017-05-18T15:48:48Z","pushed_at":"2017-05-23T03:24:54Z","git_url":"git://github.com/iamvery/ratchet-ruby.git","ssh_url":"git@github.com:iamvery/ratchet-ruby.git","clone_url":"https://github.com/iamvery/ratchet-ruby.git","svn_url":"https://github.com/iamvery/ratchet-ruby","homepage":"https://github.com/iamvery/ratchet","size":26,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/2"},"html":{"href":"https://github.com/iamvery/ratchet-ruby/pull/2"},"issue":{"href":"https://api.github.com/repos/iamvery/ratchet-ruby/issues/2"},"comments":{"href":"https://api.github.com/repos/iamvery/ratchet-ruby/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iamvery/ratchet-ruby/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/iamvery/ratchet-ruby/statuses/095aa1ef43fc1dde57afda6a64b1ada861bc768c"}}}}
{"actor":{"display_login":"iamvery"}}