GitHub PullRequestReviewCommentEvent at 2014-08-13 17:22:33
Repository: sanitize
Actor: rgrove
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/rgrove/sanitize/pulls/comments/16190358","id":16190358,"diff_hunk":"@@ -543,6 +543,23 @@ Transformers have a tremendous amount of power, including the power to\n completely bypass Sanitize's built-in filtering. Be careful! Your safety is in\n your own hands.\n \n+### Example: Removing nodes on custom criteria\n+\n+The following example demonstrates how to remove an image which isn't either on\n+a relative path or hosted on a specific domain:\n+\n+```ruby\n+images_from_whitelisted_source_transformer = lambda do |env|\n+  return unless sanitize_context[:node_name] == \"img\"\n+\n+  node = sanitize_context[:node]\n+  image_uri = URI.parse(node['src'])","path":"README.md","position":14,"original_position":14,"commit_id":"d2acd541509c25e8fb512c05ec32d31527743cfe","original_commit_id":"d2acd541509c25e8fb512c05ec32d31527743cfe","user":{"login":"rgrove","id":1465,"avatar_url":"https://avatars.githubusercontent.com/u/1465?v=2","gravatar_id":"683e9380d7cc0724a35dadfb4eeb142b","url":"https://api.github.com/users/rgrove","html_url":"https://github.com/rgrove","followers_url":"https://api.github.com/users/rgrove/followers","following_url":"https://api.github.com/users/rgrove/following{/other_user}","gists_url":"https://api.github.com/users/rgrove/gists{/gist_id}","starred_url":"https://api.github.com/users/rgrove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgrove/subscriptions","organizations_url":"https://api.github.com/users/rgrove/orgs","repos_url":"https://api.github.com/users/rgrove/repos","events_url":"https://api.github.com/users/rgrove/events{/privacy}","received_events_url":"https://api.github.com/users/rgrove/received_events","type":"User","site_admin":false},"body":"Need to `require 'uri'` to make `URI` available.","created_at":"2014-08-13T17:22:33Z","updated_at":"2014-08-13T17:22:33Z","html_url":"https://github.com/rgrove/sanitize/pull/113#discussion_r16190358","pull_request_url":"https://api.github.com/repos/rgrove/sanitize/pulls/113","_links":{"self":{"href":"https://api.github.com/repos/rgrove/sanitize/pulls/comments/16190358"},"html":{"href":"https://github.com/rgrove/sanitize/pull/113#discussion_r16190358"},"pull_request":{"href":"https://api.github.com/repos/rgrove/sanitize/pulls/113"}}},"pull_request":{"url":"https://api.github.com/repos/rgrove/sanitize/pulls/113","id":19715383,"html_url":"https://github.com/rgrove/sanitize/pull/113","diff_url":"https://github.com/rgrove/sanitize/pull/113.diff","patch_url":"https://github.com/rgrove/sanitize/pull/113.patch","issue_url":"https://api.github.com/repos/rgrove/sanitize/issues/113","number":113,"state":"open","title":"Add an example of how to remove nodes","user":{"login":"jamiecobbett","id":93739,"avatar_url":"https://avatars.githubusercontent.com/u/93739?v=2","gravatar_id":"841a554d5137a8c4bf3fea4a5d9df46a","url":"https://api.github.com/users/jamiecobbett","html_url":"https://github.com/jamiecobbett","followers_url":"https://api.github.com/users/jamiecobbett/followers","following_url":"https://api.github.com/users/jamiecobbett/following{/other_user}","gists_url":"https://api.github.com/users/jamiecobbett/gists{/gist_id}","starred_url":"https://api.github.com/users/jamiecobbett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamiecobbett/subscriptions","organizations_url":"https://api.github.com/users/jamiecobbett/orgs","repos_url":"https://api.github.com/users/jamiecobbett/repos","events_url":"https://api.github.com/users/jamiecobbett/events{/privacy}","received_events_url":"https://api.github.com/users/jamiecobbett/received_events","type":"User","site_admin":false},"body":"Using the documentation, I couldn't understand how to remove nodes and was\r\ntrying to use the return value from the transformer to do so. It wasn't until\r\nI read the built-in transformers that I spotted that they manipulate the node\r\ndirectly.","created_at":"2014-08-13T10:18:10Z","updated_at":"2014-08-13T17:22:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cbb7a04d7d71c0571cfee166cc0bb7c410ffc468","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rgrove/sanitize/pulls/113/commits","review_comments_url":"https://api.github.com/repos/rgrove/sanitize/pulls/113/comments","review_comment_url":"https://api.github.com/repos/rgrove/sanitize/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rgrove/sanitize/issues/113/comments","statuses_url":"https://api.github.com/repos/rgrove/sanitize/statuses/d2acd541509c25e8fb512c05ec32d31527743cfe","head":{"label":"jamiecobbett:add_removing_a_node_example","ref":"add_removing_a_node_example","sha":"d2acd541509c25e8fb512c05ec32d31527743cfe","user":{"login":"jamiecobbett","id":93739,"avatar_url":"https://avatars.githubusercontent.com/u/93739?v=2","gravatar_id":"841a554d5137a8c4bf3fea4a5d9df46a","url":"https://api.github.com/users/jamiecobbett","html_url":"https://github.com/jamiecobbett","followers_url":"https://api.github.com/users/jamiecobbett/followers","following_url":"https://api.github.com/users/jamiecobbett/following{/other_user}","gists_url":"https://api.github.com/users/jamiecobbett/gists{/gist_id}","starred_url":"https://api.github.com/users/jamiecobbett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamiecobbett/subscriptions","organizations_url":"https://api.github.com/users/jamiecobbett/orgs","repos_url":"https://api.github.com/users/jamiecobbett/repos","events_url":"https://api.github.com/users/jamiecobbett/events{/privacy}","received_events_url":"https://api.github.com/users/jamiecobbett/received_events","type":"User","site_admin":false},"repo":{"id":22911527,"name":"sanitize","full_name":"jamiecobbett/sanitize","owner":{"login":"jamiecobbett","id":93739,"avatar_url":"https://avatars.githubusercontent.com/u/93739?v=2","gravatar_id":"841a554d5137a8c4bf3fea4a5d9df46a","url":"https://api.github.com/users/jamiecobbett","html_url":"https://github.com/jamiecobbett","followers_url":"https://api.github.com/users/jamiecobbett/followers","following_url":"https://api.github.com/users/jamiecobbett/following{/other_user}","gists_url":"https://api.github.com/users/jamiecobbett/gists{/gist_id}","starred_url":"https://api.github.com/users/jamiecobbett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamiecobbett/subscriptions","organizations_url":"https://api.github.com/users/jamiecobbett/orgs","repos_url":"https://api.github.com/users/jamiecobbett/repos","events_url":"https://api.github.com/users/jamiecobbett/events{/privacy}","received_events_url":"https://api.github.com/users/jamiecobbett/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jamiecobbett/sanitize","description":"Whitelist-based Ruby HTML and CSS sanitizer.","fork":true,"url":"https://api.github.com/repos/jamiecobbett/sanitize","forks_url":"https://api.github.com/repos/jamiecobbett/sanitize/forks","keys_url":"https://api.github.com/repos/jamiecobbett/sanitize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jamiecobbett/sanitize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jamiecobbett/sanitize/teams","hooks_url":"https://api.github.com/repos/jamiecobbett/sanitize/hooks","issue_events_url":"https://api.github.com/repos/jamiecobbett/sanitize/issues/events{/number}","events_url":"https://api.github.com/repos/jamiecobbett/sanitize/events","assignees_url":"https://api.github.com/repos/jamiecobbett/sanitize/assignees{/user}","branches_url":"https://api.github.com/repos/jamiecobbett/sanitize/branches{/branch}","tags_url":"https://api.github.com/repos/jamiecobbett/sanitize/tags","blobs_url":"https://api.github.com/repos/jamiecobbett/sanitize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jamiecobbett/sanitize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jamiecobbett/sanitize/git/refs{/sha}","trees_url":"https://api.github.com/repos/jamiecobbett/sanitize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jamiecobbett/sanitize/statuses/{sha}","languages_url":"https://api.github.com/repos/jamiecobbett/sanitize/languages","stargazers_url":"https://api.github.com/repos/jamiecobbett/sanitize/stargazers","contributors_url":"https://api.github.com/repos/jamiecobbett/sanitize/contributors","subscribers_url":"https://api.github.com/repos/jamiecobbett/sanitize/subscribers","subscription_url":"https://api.github.com/repos/jamiecobbett/sanitize/subscription","commits_url":"https://api.github.com/repos/jamiecobbett/sanitize/commits{/sha}","git_commits_url":"https://api.github.com/repos/jamiecobbett/sanitize/git/commits{/sha}","comments_url":"https://api.github.com/repos/jamiecobbett/sanitize/comments{/number}","issue_comment_url":"https://api.github.com/repos/jamiecobbett/sanitize/issues/comments/{number}","contents_url":"https://api.github.com/repos/jamiecobbett/sanitize/contents/{+path}","compare_url":"https://api.github.com/repos/jamiecobbett/sanitize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jamiecobbett/sanitize/merges","archive_url":"https://api.github.com/repos/jamiecobbett/sanitize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jamiecobbett/sanitize/downloads","issues_url":"https://api.github.com/repos/jamiecobbett/sanitize/issues{/number}","pulls_url":"https://api.github.com/repos/jamiecobbett/sanitize/pulls{/number}","milestones_url":"https://api.github.com/repos/jamiecobbett/sanitize/milestones{/number}","notifications_url":"https://api.github.com/repos/jamiecobbett/sanitize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jamiecobbett/sanitize/labels{/name}","releases_url":"https://api.github.com/repos/jamiecobbett/sanitize/releases{/id}","created_at":"2014-08-13T10:14:39Z","updated_at":"2014-08-10T18:43:21Z","pushed_at":"2014-08-13T10:17:50Z","git_url":"git://github.com/jamiecobbett/sanitize.git","ssh_url":"git@github.com:jamiecobbett/sanitize.git","clone_url":"https://github.com/jamiecobbett/sanitize.git","svn_url":"https://github.com/jamiecobbett/sanitize","homepage":"","size":1786,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rgrove:master","ref":"master","sha":"cebb3cb9b04b8ed8986ef85082cc15549fde6776","user":{"login":"rgrove","id":1465,"avatar_url":"https://avatars.githubusercontent.com/u/1465?v=2","gravatar_id":"683e9380d7cc0724a35dadfb4eeb142b","url":"https://api.github.com/users/rgrove","html_url":"https://github.com/rgrove","followers_url":"https://api.github.com/users/rgrove/followers","following_url":"https://api.github.com/users/rgrove/following{/other_user}","gists_url":"https://api.github.com/users/rgrove/gists{/gist_id}","starred_url":"https://api.github.com/users/rgrove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgrove/subscriptions","organizations_url":"https://api.github.com/users/rgrove/orgs","repos_url":"https://api.github.com/users/rgrove/repos","events_url":"https://api.github.com/users/rgrove/events{/privacy}","received_events_url":"https://api.github.com/users/rgrove/received_events","type":"User","site_admin":false},"repo":{"id":96577,"name":"sanitize","full_name":"rgrove/sanitize","owner":{"login":"rgrove","id":1465,"avatar_url":"https://avatars.githubusercontent.com/u/1465?v=2","gravatar_id":"683e9380d7cc0724a35dadfb4eeb142b","url":"https://api.github.com/users/rgrove","html_url":"https://github.com/rgrove","followers_url":"https://api.github.com/users/rgrove/followers","following_url":"https://api.github.com/users/rgrove/following{/other_user}","gists_url":"https://api.github.com/users/rgrove/gists{/gist_id}","starred_url":"https://api.github.com/users/rgrove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgrove/subscriptions","organizations_url":"https://api.github.com/users/rgrove/orgs","repos_url":"https://api.github.com/users/rgrove/repos","events_url":"https://api.github.com/users/rgrove/events{/privacy}","received_events_url":"https://api.github.com/users/rgrove/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rgrove/sanitize","description":"Whitelist-based Ruby HTML and CSS sanitizer.","fork":false,"url":"https://api.github.com/repos/rgrove/sanitize","forks_url":"https://api.github.com/repos/rgrove/sanitize/forks","keys_url":"https://api.github.com/repos/rgrove/sanitize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rgrove/sanitize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rgrove/sanitize/teams","hooks_url":"https://api.github.com/repos/rgrove/sanitize/hooks","issue_events_url":"https://api.github.com/repos/rgrove/sanitize/issues/events{/number}","events_url":"https://api.github.com/repos/rgrove/sanitize/events","assignees_url":"https://api.github.com/repos/rgrove/sanitize/assignees{/user}","branches_url":"https://api.github.com/repos/rgrove/sanitize/branches{/branch}","tags_url":"https://api.github.com/repos/rgrove/sanitize/tags","blobs_url":"https://api.github.com/repos/rgrove/sanitize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rgrove/sanitize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rgrove/sanitize/git/refs{/sha}","trees_url":"https://api.github.com/repos/rgrove/sanitize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rgrove/sanitize/statuses/{sha}","languages_url":"https://api.github.com/repos/rgrove/sanitize/languages","stargazers_url":"https://api.github.com/repos/rgrove/sanitize/stargazers","contributors_url":"https://api.github.com/repos/rgrove/sanitize/contributors","subscribers_url":"https://api.github.com/repos/rgrove/sanitize/subscribers","subscription_url":"https://api.github.com/repos/rgrove/sanitize/subscription","commits_url":"https://api.github.com/repos/rgrove/sanitize/commits{/sha}","git_commits_url":"https://api.github.com/repos/rgrove/sanitize/git/commits{/sha}","comments_url":"https://api.github.com/repos/rgrove/sanitize/comments{/number}","issue_comment_url":"https://api.github.com/repos/rgrove/sanitize/issues/comments/{number}","contents_url":"https://api.github.com/repos/rgrove/sanitize/contents/{+path}","compare_url":"https://api.github.com/repos/rgrove/sanitize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rgrove/sanitize/merges","archive_url":"https://api.github.com/repos/rgrove/sanitize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rgrove/sanitize/downloads","issues_url":"https://api.github.com/repos/rgrove/sanitize/issues{/number}","pulls_url":"https://api.github.com/repos/rgrove/sanitize/pulls{/number}","milestones_url":"https://api.github.com/repos/rgrove/sanitize/milestones{/number}","notifications_url":"https://api.github.com/repos/rgrove/sanitize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rgrove/sanitize/labels{/name}","releases_url":"https://api.github.com/repos/rgrove/sanitize/releases{/id}","created_at":"2008-12-25T06:03:43Z","updated_at":"2014-08-10T18:43:21Z","pushed_at":"2014-06-23T19:59:39Z","git_url":"git://github.com/rgrove/sanitize.git","ssh_url":"git@github.com:rgrove/sanitize.git","clone_url":"https://github.com/rgrove/sanitize.git","svn_url":"https://github.com/rgrove/sanitize","homepage":"","size":2651,"stargazers_count":1203,"watchers_count":1203,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":71,"mirror_url":null,"open_issues_count":2,"forks":71,"open_issues":2,"watchers":1203,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rgrove/sanitize/pulls/113"},"html":{"href":"https://github.com/rgrove/sanitize/pull/113"},"issue":{"href":"https://api.github.com/repos/rgrove/sanitize/issues/113"},"comments":{"href":"https://api.github.com/repos/rgrove/sanitize/issues/113/comments"},"review_comments":{"href":"https://api.github.com/repos/rgrove/sanitize/pulls/113/comments"},"review_comment":{"href":"https://api.github.com/repos/rgrove/sanitize/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rgrove/sanitize/pulls/113/commits"},"statuses":{"href":"https://api.github.com/repos/rgrove/sanitize/statuses/d2acd541509c25e8fb512c05ec32d31527743cfe"}}}}