{"action":"created","comment":{"url":"https://api.github.com/repos/jbowens/jBBCode/pulls/comments/100978970","pull_request_review_id":21696105,"id":100978970,"diff_hunk":"@@ -123,14 +141,17 @@ public function getAsText()\n      */\n     public function getAsBBCode()\n     {\n-        $str = \"[\".$this->tagName;\n+        $str = \"[\".$this->originalTagName;\n         if (!empty($this->attribute)) {\n-            if(isset($this->attribute[$this->tagName])) {\n-                $str .= \"=\".$this->attribute[$this->tagName];\n+            if (isset($this->attribute[$this->originalTagName])) {\n+                // avoid to generate something like [FOO= bar=baz]...[/FOO]\n+                if (!empty($this->attribute[$this->originalTagName]) || !$this->hasChildren()) {\n+                    $str .= \"=\".$this->attribute[$this->originalTagName];\n+                }\n             }\n \n-            foreach($this->attribute as $key => $value){\n-                if($key == $this->tagName){\n+            foreach ($this->attribute as $key => $value) {\n+                if ($this->normalize($key) == $this->normalize($this->originalTagName)) {","path":"JBBCode/ElementNode.php","position":58,"original_position":58,"commit_id":"6005b2cb0efe27943f7c04c6dcae696085a12d0c","original_commit_id":"6005b2cb0efe27943f7c04c6dcae696085a12d0c","user":{"login":"frastel","id":433380,"avatar_url":"https://avatars.githubusercontent.com/u/433380?v=3","gravatar_id":"","url":"https://api.github.com/users/frastel","html_url":"https://github.com/frastel","followers_url":"https://api.github.com/users/frastel/followers","following_url":"https://api.github.com/users/frastel/following{/other_user}","gists_url":"https://api.github.com/users/frastel/gists{/gist_id}","starred_url":"https://api.github.com/users/frastel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frastel/subscriptions","organizations_url":"https://api.github.com/users/frastel/orgs","repos_url":"https://api.github.com/users/frastel/repos","events_url":"https://api.github.com/users/frastel/events{/privacy}","received_events_url":"https://api.github.com/users/frastel/received_events","type":"User","site_admin":false},"body":"I was worried about this change by myself too. I'll go for the strcasecmp approach.","created_at":"2017-02-14T08:23:39Z","updated_at":"2017-02-14T08:23:39Z","html_url":"https://github.com/jbowens/jBBCode/pull/76#discussion_r100978970","pull_request_url":"https://api.github.com/repos/jbowens/jBBCode/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/jbowens/jBBCode/pulls/comments/100978970"},"html":{"href":"https://github.com/jbowens/jBBCode/pull/76#discussion_r100978970"},"pull_request":{"href":"https://api.github.com/repos/jbowens/jBBCode/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/jbowens/jBBCode/pulls/76","id":105874631,"html_url":"https://github.com/jbowens/jBBCode/pull/76","diff_url":"https://github.com/jbowens/jBBCode/pull/76.diff","patch_url":"https://github.com/jbowens/jBBCode/pull/76.patch","issue_url":"https://api.github.com/repos/jbowens/jBBCode/issues/76","number":76,"state":"open","locked":false,"title":"[WIP]  fixed generation of bbcode for uppercased tags","user":{"login":"frastel","id":433380,"avatar_url":"https://avatars.githubusercontent.com/u/433380?v=3","gravatar_id":"","url":"https://api.github.com/users/frastel","html_url":"https://github.com/frastel","followers_url":"https://api.github.com/users/frastel/followers","following_url":"https://api.github.com/users/frastel/following{/other_user}","gists_url":"https://api.github.com/users/frastel/gists{/gist_id}","starred_url":"https://api.github.com/users/frastel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frastel/subscriptions","organizations_url":"https://api.github.com/users/frastel/orgs","repos_url":"https://api.github.com/users/frastel/repos","events_url":"https://api.github.com/users/frastel/events{/privacy}","received_events_url":"https://api.github.com/users/frastel/received_events","type":"User","site_admin":false},"body":"This PR is actually based on my other cleanup PR. This PR makes only sense after the cleanup PR has been merged.\r\n\r\nI found two issues:\r\n* when uppercased tags were used and the text was invalid than the code was not able to re-build the original code. `[URL=INVALID]foo[/URL]` was  generated to `[url=invalid]foo[/url]`.\r\n* when options were enabled but the tag itself had no option and the text was invalid than the code added an empty `=`. So `[URL foo=bar]INVALID[/URL]` was generated to `[url= foo=bar]INVALID[/url]`.\r\n\r\nI am not quite sure if the change in `ElementNode::getAsBBCode` for the empty `=` is the best solution. Therefore this PR is still WIP. Any feedback appreciated!\r\n\r\n","created_at":"2017-02-13T11:25:00Z","updated_at":"2017-02-14T08:23:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe1bb37ef86058405b576e6ec7077893f3374732","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/jbowens/jBBCode/pulls/76/commits","review_comments_url":"https://api.github.com/repos/jbowens/jBBCode/pulls/76/comments","review_comment_url":"https://api.github.com/repos/jbowens/jBBCode/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jbowens/jBBCode/issues/76/comments","statuses_url":"https://api.github.com/repos/jbowens/jBBCode/statuses/6005b2cb0efe27943f7c04c6dcae696085a12d0c","head":{"label":"chefkoch-dev:fix/tag-normalization","ref":"fix/tag-normalization","sha":"6005b2cb0efe27943f7c04c6dcae696085a12d0c","user":{"login":"chefkoch-dev","id":12325519,"avatar_url":"https://avatars.githubusercontent.com/u/12325519?v=3","gravatar_id":"","url":"https://api.github.com/users/chefkoch-dev","html_url":"https://github.com/chefkoch-dev","followers_url":"https://api.github.com/users/chefkoch-dev/followers","following_url":"https://api.github.com/users/chefkoch-dev/following{/other_user}","gists_url":"https://api.github.com/users/chefkoch-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/chefkoch-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chefkoch-dev/subscriptions","organizations_url":"https://api.github.com/users/chefkoch-dev/orgs","repos_url":"https://api.github.com/users/chefkoch-dev/repos","events_url":"https://api.github.com/users/chefkoch-dev/events{/privacy}","received_events_url":"https://api.github.com/users/chefkoch-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":81799388,"name":"jBBCode","full_name":"chefkoch-dev/jBBCode","owner":{"login":"chefkoch-dev","id":12325519,"avatar_url":"https://avatars.githubusercontent.com/u/12325519?v=3","gravatar_id":"","url":"https://api.github.com/users/chefkoch-dev","html_url":"https://github.com/chefkoch-dev","followers_url":"https://api.github.com/users/chefkoch-dev/followers","following_url":"https://api.github.com/users/chefkoch-dev/following{/other_user}","gists_url":"https://api.github.com/users/chefkoch-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/chefkoch-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chefkoch-dev/subscriptions","organizations_url":"https://api.github.com/users/chefkoch-dev/orgs","repos_url":"https://api.github.com/users/chefkoch-dev/repos","events_url":"https://api.github.com/users/chefkoch-dev/events{/privacy}","received_events_url":"https://api.github.com/users/chefkoch-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chefkoch-dev/jBBCode","description":"A lightweight but extensible BBCode parser written in PHP 5.3.","fork":true,"url":"https://api.github.com/repos/chefkoch-dev/jBBCode","forks_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/forks","keys_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/teams","hooks_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/hooks","issue_events_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/issues/events{/number}","events_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/events","assignees_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/assignees{/user}","branches_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/branches{/branch}","tags_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/tags","blobs_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/git/refs{/sha}","trees_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/statuses/{sha}","languages_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/languages","stargazers_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/stargazers","contributors_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/contributors","subscribers_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/subscribers","subscription_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/subscription","commits_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/commits{/sha}","git_commits_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/git/commits{/sha}","comments_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/comments{/number}","issue_comment_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/issues/comments{/number}","contents_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/contents/{+path}","compare_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/merges","archive_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/downloads","issues_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/issues{/number}","pulls_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/pulls{/number}","milestones_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/milestones{/number}","notifications_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/labels{/name}","releases_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/releases{/id}","deployments_url":"https://api.github.com/repos/chefkoch-dev/jBBCode/deployments","created_at":"2017-02-13T07:56:00Z","updated_at":"2017-02-13T07:56:02Z","pushed_at":"2017-02-13T20:41:41Z","git_url":"git://github.com/chefkoch-dev/jBBCode.git","ssh_url":"git@github.com:chefkoch-dev/jBBCode.git","clone_url":"https://github.com/chefkoch-dev/jBBCode.git","svn_url":"https://github.com/chefkoch-dev/jBBCode","homepage":"http://jbbcode.com","size":159,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"jbowens:master","ref":"master","sha":"ca659acfa30d75a783ec917dd97868fe4a4fecb8","user":{"login":"jbowens","id":867352,"avatar_url":"https://avatars.githubusercontent.com/u/867352?v=3","gravatar_id":"","url":"https://api.github.com/users/jbowens","html_url":"https://github.com/jbowens","followers_url":"https://api.github.com/users/jbowens/followers","following_url":"https://api.github.com/users/jbowens/following{/other_user}","gists_url":"https://api.github.com/users/jbowens/gists{/gist_id}","starred_url":"https://api.github.com/users/jbowens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbowens/subscriptions","organizations_url":"https://api.github.com/users/jbowens/orgs","repos_url":"https://api.github.com/users/jbowens/repos","events_url":"https://api.github.com/users/jbowens/events{/privacy}","received_events_url":"https://api.github.com/users/jbowens/received_events","type":"User","site_admin":false},"repo":{"id":4447681,"name":"jBBCode","full_name":"jbowens/jBBCode","owner":{"login":"jbowens","id":867352,"avatar_url":"https://avatars.githubusercontent.com/u/867352?v=3","gravatar_id":"","url":"https://api.github.com/users/jbowens","html_url":"https://github.com/jbowens","followers_url":"https://api.github.com/users/jbowens/followers","following_url":"https://api.github.com/users/jbowens/following{/other_user}","gists_url":"https://api.github.com/users/jbowens/gists{/gist_id}","starred_url":"https://api.github.com/users/jbowens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbowens/subscriptions","organizations_url":"https://api.github.com/users/jbowens/orgs","repos_url":"https://api.github.com/users/jbowens/repos","events_url":"https://api.github.com/users/jbowens/events{/privacy}","received_events_url":"https://api.github.com/users/jbowens/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jbowens/jBBCode","description":"A lightweight but extensible BBCode parser written in PHP 5.3.","fork":false,"url":"https://api.github.com/repos/jbowens/jBBCode","forks_url":"https://api.github.com/repos/jbowens/jBBCode/forks","keys_url":"https://api.github.com/repos/jbowens/jBBCode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jbowens/jBBCode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jbowens/jBBCode/teams","hooks_url":"https://api.github.com/repos/jbowens/jBBCode/hooks","issue_events_url":"https://api.github.com/repos/jbowens/jBBCode/issues/events{/number}","events_url":"https://api.github.com/repos/jbowens/jBBCode/events","assignees_url":"https://api.github.com/repos/jbowens/jBBCode/assignees{/user}","branches_url":"https://api.github.com/repos/jbowens/jBBCode/branches{/branch}","tags_url":"https://api.github.com/repos/jbowens/jBBCode/tags","blobs_url":"https://api.github.com/repos/jbowens/jBBCode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jbowens/jBBCode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jbowens/jBBCode/git/refs{/sha}","trees_url":"https://api.github.com/repos/jbowens/jBBCode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jbowens/jBBCode/statuses/{sha}","languages_url":"https://api.github.com/repos/jbowens/jBBCode/languages","stargazers_url":"https://api.github.com/repos/jbowens/jBBCode/stargazers","contributors_url":"https://api.github.com/repos/jbowens/jBBCode/contributors","subscribers_url":"https://api.github.com/repos/jbowens/jBBCode/subscribers","subscription_url":"https://api.github.com/repos/jbowens/jBBCode/subscription","commits_url":"https://api.github.com/repos/jbowens/jBBCode/commits{/sha}","git_commits_url":"https://api.github.com/repos/jbowens/jBBCode/git/commits{/sha}","comments_url":"https://api.github.com/repos/jbowens/jBBCode/comments{/number}","issue_comment_url":"https://api.github.com/repos/jbowens/jBBCode/issues/comments{/number}","contents_url":"https://api.github.com/repos/jbowens/jBBCode/contents/{+path}","compare_url":"https://api.github.com/repos/jbowens/jBBCode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jbowens/jBBCode/merges","archive_url":"https://api.github.com/repos/jbowens/jBBCode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jbowens/jBBCode/downloads","issues_url":"https://api.github.com/repos/jbowens/jBBCode/issues{/number}","pulls_url":"https://api.github.com/repos/jbowens/jBBCode/pulls{/number}","milestones_url":"https://api.github.com/repos/jbowens/jBBCode/milestones{/number}","notifications_url":"https://api.github.com/repos/jbowens/jBBCode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jbowens/jBBCode/labels{/name}","releases_url":"https://api.github.com/repos/jbowens/jBBCode/releases{/id}","deployments_url":"https://api.github.com/repos/jbowens/jBBCode/deployments","created_at":"2012-05-25T16:42:25Z","updated_at":"2017-02-13T09:11:32Z","pushed_at":"2017-02-13T20:41:43Z","git_url":"git://github.com/jbowens/jBBCode.git","ssh_url":"git@github.com:jbowens/jBBCode.git","clone_url":"https://github.com/jbowens/jBBCode.git","svn_url":"https://github.com/jbowens/jBBCode","homepage":"http://jbbcode.com","size":150,"stargazers_count":122,"watchers_count":122,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":21,"forks":31,"open_issues":21,"watchers":122,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jbowens/jBBCode/pulls/76"},"html":{"href":"https://github.com/jbowens/jBBCode/pull/76"},"issue":{"href":"https://api.github.com/repos/jbowens/jBBCode/issues/76"},"comments":{"href":"https://api.github.com/repos/jbowens/jBBCode/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/jbowens/jBBCode/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/jbowens/jBBCode/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jbowens/jBBCode/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/jbowens/jBBCode/statuses/6005b2cb0efe27943f7c04c6dcae696085a12d0c"}}}}
{"actor":{"display_login":"frastel"}}