{"action":"created","comment":{"url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/comments/22441126","id":22441126,"diff_hunk":"@@ -38,21 +30,51 @@ class ChartBlockProcessor < Extensions::BlockProcessor\n   parse_content_as :raw\n \n   def process(parent, reader, attrs)\n+    backend = (attrs.key? 'backend') ? attrs['backend'].downcase : 'c3js'\n     raw_data = CSV.parse(reader.source)\n-    data, labels = C3jsChartBuilder.prepare_data(raw_data)\n-    html = (case attrs['type']\n-      when 'bar' then C3jsChartBuilder.bar data, labels\n-      when 'line' then C3jsChartBuilder.line data, labels\n-      when 'step' then C3jsChartBuilder.step data, labels\n-      when 'spline' then C3jsChartBuilder.spline data, labels\n-      else\n-        # By default chart line\n-        C3jsChartBuilder.line data, labels\n-    end)\n+    html = ChartBackend.process backend, attrs['type'], raw_data\n     create_pass_block parent, html, attrs, subs: nil\n   end\n end\n \n+class ChartBackend\n+\n+  def self.process backend, type, raw_data\n+    # TODO Check that the backend can process the required type (bar, line, step...)\n+    case backend","path":"lib/chart-block-macro/extension.rb","position":45,"original_position":45,"commit_id":"77a82c1a45cba86f6dc9b0376f96c8b70fef6269","original_commit_id":"77a82c1a45cba86f6dc9b0376f96c8b70fef6269","user":{"login":"Mogztter","id":333276,"avatar_url":"https://avatars.githubusercontent.com/u/333276?v=3","gravatar_id":"","url":"https://api.github.com/users/Mogztter","html_url":"https://github.com/Mogztter","followers_url":"https://api.github.com/users/Mogztter/followers","following_url":"https://api.github.com/users/Mogztter/following{/other_user}","gists_url":"https://api.github.com/users/Mogztter/gists{/gist_id}","starred_url":"https://api.github.com/users/Mogztter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mogztter/subscriptions","organizations_url":"https://api.github.com/users/Mogztter/orgs","repos_url":"https://api.github.com/users/Mogztter/repos","events_url":"https://api.github.com/users/Mogztter/events{/privacy}","received_events_url":"https://api.github.com/users/Mogztter/received_events","type":"User","site_admin":false},"body":"I need to rewrite that part to be able to do:\r\n\r\n```ruby\r\nbuilder = get_chart_builder backend\r\nbuilder.build type\r\n```\r\n\r\n","created_at":"2015-01-04T18:07:31Z","updated_at":"2015-01-04T18:07:31Z","html_url":"https://github.com/asciidoctor/asciidoctor-extensions-lab/pull/32#discussion_r22441126","pull_request_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/32","_links":{"self":{"href":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/comments/22441126"},"html":{"href":"https://github.com/asciidoctor/asciidoctor-extensions-lab/pull/32#discussion_r22441126"},"pull_request":{"href":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/32"}}},"pull_request":{"url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/32","id":26797649,"html_url":"https://github.com/asciidoctor/asciidoctor-extensions-lab/pull/32","diff_url":"https://github.com/asciidoctor/asciidoctor-extensions-lab/pull/32.diff","patch_url":"https://github.com/asciidoctor/asciidoctor-extensions-lab/pull/32.patch","issue_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/issues/32","number":32,"state":"open","locked":false,"title":"Add Chartist.js backend to the chart macro extension","user":{"login":"Mogztter","id":333276,"avatar_url":"https://avatars.githubusercontent.com/u/333276?v=3","gravatar_id":"","url":"https://api.github.com/users/Mogztter","html_url":"https://github.com/Mogztter","followers_url":"https://api.github.com/users/Mogztter/followers","following_url":"https://api.github.com/users/Mogztter/following{/other_user}","gists_url":"https://api.github.com/users/Mogztter/gists{/gist_id}","starred_url":"https://api.github.com/users/Mogztter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mogztter/subscriptions","organizations_url":"https://api.github.com/users/Mogztter/orgs","repos_url":"https://api.github.com/users/Mogztter/repos","events_url":"https://api.github.com/users/Mogztter/events{/privacy}","received_events_url":"https://api.github.com/users/Mogztter/received_events","type":"User","site_admin":false},"body":"Resolves #24","created_at":"2015-01-04T18:02:43Z","updated_at":"2015-01-04T18:07:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a236cfe426e7183ff381c81d5f2b731d011464e6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/32/commits","review_comments_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/32/comments","review_comment_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/comments/{number}","comments_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/issues/32/comments","statuses_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/statuses/77a82c1a45cba86f6dc9b0376f96c8b70fef6269","head":{"label":"Mogztter:issue-24","ref":"issue-24","sha":"77a82c1a45cba86f6dc9b0376f96c8b70fef6269","user":{"login":"Mogztter","id":333276,"avatar_url":"https://avatars.githubusercontent.com/u/333276?v=3","gravatar_id":"","url":"https://api.github.com/users/Mogztter","html_url":"https://github.com/Mogztter","followers_url":"https://api.github.com/users/Mogztter/followers","following_url":"https://api.github.com/users/Mogztter/following{/other_user}","gists_url":"https://api.github.com/users/Mogztter/gists{/gist_id}","starred_url":"https://api.github.com/users/Mogztter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mogztter/subscriptions","organizations_url":"https://api.github.com/users/Mogztter/orgs","repos_url":"https://api.github.com/users/Mogztter/repos","events_url":"https://api.github.com/users/Mogztter/events{/privacy}","received_events_url":"https://api.github.com/users/Mogztter/received_events","type":"User","site_admin":false},"repo":{"id":22389587,"name":"asciidoctor-extensions-lab","full_name":"Mogztter/asciidoctor-extensions-lab","owner":{"login":"Mogztter","id":333276,"avatar_url":"https://avatars.githubusercontent.com/u/333276?v=3","gravatar_id":"","url":"https://api.github.com/users/Mogztter","html_url":"https://github.com/Mogztter","followers_url":"https://api.github.com/users/Mogztter/followers","following_url":"https://api.github.com/users/Mogztter/following{/other_user}","gists_url":"https://api.github.com/users/Mogztter/gists{/gist_id}","starred_url":"https://api.github.com/users/Mogztter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mogztter/subscriptions","organizations_url":"https://api.github.com/users/Mogztter/orgs","repos_url":"https://api.github.com/users/Mogztter/repos","events_url":"https://api.github.com/users/Mogztter/events{/privacy}","received_events_url":"https://api.github.com/users/Mogztter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mogztter/asciidoctor-extensions-lab","description":"A lab and incubator for Asciidoctor extensions.","fork":true,"url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab","forks_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/forks","keys_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/teams","hooks_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/hooks","issue_events_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/issues/events{/number}","events_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/events","assignees_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/assignees{/user}","branches_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/branches{/branch}","tags_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/tags","blobs_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/statuses/{sha}","languages_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/languages","stargazers_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/stargazers","contributors_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/contributors","subscribers_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/subscribers","subscription_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/subscription","commits_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/issues/comments/{number}","contents_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/contents/{+path}","compare_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/merges","archive_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/downloads","issues_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/issues{/number}","pulls_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/pulls{/number}","milestones_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/milestones{/number}","notifications_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/labels{/name}","releases_url":"https://api.github.com/repos/Mogztter/asciidoctor-extensions-lab/releases{/id}","created_at":"2014-07-29T17:51:58Z","updated_at":"2015-01-04T16:58:29Z","pushed_at":"2015-01-04T18:02:36Z","git_url":"git://github.com/Mogztter/asciidoctor-extensions-lab.git","ssh_url":"git@github.com:Mogztter/asciidoctor-extensions-lab.git","clone_url":"https://github.com/Mogztter/asciidoctor-extensions-lab.git","svn_url":"https://github.com/Mogztter/asciidoctor-extensions-lab","homepage":null,"size":320,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"asciidoctor:master","ref":"master","sha":"9ce5d0c066941c71b44bcce0fa57f26f72be7b2e","user":{"login":"asciidoctor","id":3137042,"avatar_url":"https://avatars.githubusercontent.com/u/3137042?v=3","gravatar_id":"","url":"https://api.github.com/users/asciidoctor","html_url":"https://github.com/asciidoctor","followers_url":"https://api.github.com/users/asciidoctor/followers","following_url":"https://api.github.com/users/asciidoctor/following{/other_user}","gists_url":"https://api.github.com/users/asciidoctor/gists{/gist_id}","starred_url":"https://api.github.com/users/asciidoctor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asciidoctor/subscriptions","organizations_url":"https://api.github.com/users/asciidoctor/orgs","repos_url":"https://api.github.com/users/asciidoctor/repos","events_url":"https://api.github.com/users/asciidoctor/events{/privacy}","received_events_url":"https://api.github.com/users/asciidoctor/received_events","type":"Organization","site_admin":false},"repo":{"id":16607974,"name":"asciidoctor-extensions-lab","full_name":"asciidoctor/asciidoctor-extensions-lab","owner":{"login":"asciidoctor","id":3137042,"avatar_url":"https://avatars.githubusercontent.com/u/3137042?v=3","gravatar_id":"","url":"https://api.github.com/users/asciidoctor","html_url":"https://github.com/asciidoctor","followers_url":"https://api.github.com/users/asciidoctor/followers","following_url":"https://api.github.com/users/asciidoctor/following{/other_user}","gists_url":"https://api.github.com/users/asciidoctor/gists{/gist_id}","starred_url":"https://api.github.com/users/asciidoctor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asciidoctor/subscriptions","organizations_url":"https://api.github.com/users/asciidoctor/orgs","repos_url":"https://api.github.com/users/asciidoctor/repos","events_url":"https://api.github.com/users/asciidoctor/events{/privacy}","received_events_url":"https://api.github.com/users/asciidoctor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/asciidoctor/asciidoctor-extensions-lab","description":"A lab and incubator for Asciidoctor extensions.","fork":false,"url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab","forks_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/forks","keys_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/teams","hooks_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/hooks","issue_events_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/issues/events{/number}","events_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/events","assignees_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/assignees{/user}","branches_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/branches{/branch}","tags_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/tags","blobs_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/git/refs{/sha}","trees_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/statuses/{sha}","languages_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/languages","stargazers_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/stargazers","contributors_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/contributors","subscribers_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/subscribers","subscription_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/subscription","commits_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/commits{/sha}","git_commits_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/git/commits{/sha}","comments_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/comments{/number}","issue_comment_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/issues/comments/{number}","contents_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/contents/{+path}","compare_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/merges","archive_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/downloads","issues_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/issues{/number}","pulls_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls{/number}","milestones_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/milestones{/number}","notifications_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/labels{/name}","releases_url":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/releases{/id}","created_at":"2014-02-07T07:59:01Z","updated_at":"2014-12-18T08:47:59Z","pushed_at":"2014-12-18T08:47:59Z","git_url":"git://github.com/asciidoctor/asciidoctor-extensions-lab.git","ssh_url":"git@github.com:asciidoctor/asciidoctor-extensions-lab.git","clone_url":"https://github.com/asciidoctor/asciidoctor-extensions-lab.git","svn_url":"https://github.com/asciidoctor/asciidoctor-extensions-lab","homepage":null,"size":530,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":21,"forks":10,"open_issues":21,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/32"},"html":{"href":"https://github.com/asciidoctor/asciidoctor-extensions-lab/pull/32"},"issue":{"href":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/issues/32"},"comments":{"href":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/issues/32/comments"},"review_comments":{"href":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/32/comments"},"review_comment":{"href":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/pulls/32/commits"},"statuses":{"href":"https://api.github.com/repos/asciidoctor/asciidoctor-extensions-lab/statuses/77a82c1a45cba86f6dc9b0376f96c8b70fef6269"}}}}