{"action":"created","comment":{"url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/comments/39602478","id":39602478,"diff_hunk":"@@ -97,6 +104,122 @@ public function loadDefinitionsFromService(BBcodeDefinitionCollectionInterface $\n      */\n     public function getCodes()\n     {\n-        return $this->codes;\n+        return $this->bbcodes;\n+    }\n+\n+    /**\n+     * Get all registered validators\n+     * \n+     * @return array\n+     */\n+    public function getValidators()\n+    {\n+        return $this->validators;\n+    }\n+\n+    /**\n+     * Get html from BBcode\n+     * \n+     * @return string\n+     */\n+    public function getAsPreviewHTML()\n+    {\n+        return $this->treeRoot->getAsPreviewHTML();\n+    }\n+\n+    /**\n+     * Removes the old parse tree if one exists.\n+     */\n+    protected function reset()\n+    {\n+        $this->treeRoot = new BBcodeDocumentElement();\n+        $this->nextNodeid = 1;\n+    }\n+\n+    /**\n+     * Creates a new text node with the given parent and text string.\n+     *\n+     * @param $parent  the parent of the text node\n+     * @param $string  the text of the text node\n+     *\n+     * @return TextNode the newly created TextNode\n+     */\n+    protected function createTextNode(ElementNode $parent, $string)\n+    {\n+        if (count($parent->getChildren())) {\n+            $children = $parent->getChildren();\n+            $lastElement = end($children);\n+            reset($children);\n+\n+            if ($lastElement->isTextNode()) {\n+                $lastElement->setValue($lastElement->getValue() . $string);\n+                return $lastElement;\n+            }\n+        }\n+\n+        $textNode = new BBcodeTextNode($string);\n+        $textNode->setNodeId(++$this->nextNodeid);\n+        $parent->addChild($textNode);\n+        return $textNode;\n+    }\n+\n+    /**\n+     * This is the next step in parsing a tag. It's possible for it to still be invalid at this\n+     * point but many of the basic invalid tag name conditions have already been handled.\n+     *\n+     * @param ElementNode $parent  the current parent element\n+     * @param Tokenizer   $tokenizer  the tokenizer we're using\n+     * @param string      $tagContent  the text between the [ and the ], assuming there is actually a ]\n+     *\n+     * @return ElementNode the new parent element\n+     */\n+    protected function parseTag(ElementNode $parent, Tokenizer $tokenizer, $tagContent)\n+    {\n+        $next;\n+        if (!$tokenizer->hasNext() || ($next = $tokenizer->next()) != ']') {\n+            $this->createTextNode($parent, '[');\n+            $this->createTextNode($parent, $tagContent);\n+            return $parent;\n+        }\n+\n+        list($tmpTagName, $options) = $this->parseOptions($tagContent);\n+\n+        $actualTagName;\n+        if ('' != $tmpTagName && '/' == $tmpTagName[0]) {\n+           $actualTagName = substr($tmpTagName, 1);\n+        } else {\n+            $actualTagName = $tmpTagName;\n+        }\n+\n+        if ('' != $tmpTagName && '/' == $tmpTagName[0]) {\n+            $elToClose = $parent->closestParentOfType($actualTagName);\n+            if (null === $elToClose || count($options) > 1)\n+            if (null === $elToClose || count($options) > 1) {\n+                $this->createTextNode($parent, '[');\n+                $this->createTextNode($parent, $tagContent);\n+                $this->createTextNode($parent, ']');\n+                return $parent;","path":"BBcodeBundle/Parser/BBcodeParser.php","position":188,"original_position":188,"commit_id":"f86c4b02046783b6b2366a73b9253e5a82231e6b","original_commit_id":"f86c4b02046783b6b2366a73b9253e5a82231e6b","user":{"login":"itkg-alavieille","id":11750768,"avatar_url":"https://avatars.githubusercontent.com/u/11750768?v=3","gravatar_id":"","url":"https://api.github.com/users/itkg-alavieille","html_url":"https://github.com/itkg-alavieille","followers_url":"https://api.github.com/users/itkg-alavieille/followers","following_url":"https://api.github.com/users/itkg-alavieille/following{/other_user}","gists_url":"https://api.github.com/users/itkg-alavieille/gists{/gist_id}","starred_url":"https://api.github.com/users/itkg-alavieille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itkg-alavieille/subscriptions","organizations_url":"https://api.github.com/users/itkg-alavieille/orgs","repos_url":"https://api.github.com/users/itkg-alavieille/repos","events_url":"https://api.github.com/users/itkg-alavieille/events{/privacy}","received_events_url":"https://api.github.com/users/itkg-alavieille/received_events","type":"User","site_admin":false},"body":"add an empty line","created_at":"2015-09-16T08:00:49Z","updated_at":"2015-09-16T08:00:49Z","html_url":"https://github.com/open-orchestra/open-orchestra-display-bundle/pull/172#discussion_r39602478","pull_request_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/172","_links":{"self":{"href":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/comments/39602478"},"html":{"href":"https://github.com/open-orchestra/open-orchestra-display-bundle/pull/172#discussion_r39602478"},"pull_request":{"href":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/172"}}},"pull_request":{"url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/172","id":44687031,"html_url":"https://github.com/open-orchestra/open-orchestra-display-bundle/pull/172","diff_url":"https://github.com/open-orchestra/open-orchestra-display-bundle/pull/172.diff","patch_url":"https://github.com/open-orchestra/open-orchestra-display-bundle/pull/172.patch","issue_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/issues/172","number":172,"state":"open","locked":false,"title":"Update BBcodeBundle to allow complex tag creation","user":{"login":"itkg-ngilain","id":6725138,"avatar_url":"https://avatars.githubusercontent.com/u/6725138?v=3","gravatar_id":"","url":"https://api.github.com/users/itkg-ngilain","html_url":"https://github.com/itkg-ngilain","followers_url":"https://api.github.com/users/itkg-ngilain/followers","following_url":"https://api.github.com/users/itkg-ngilain/following{/other_user}","gists_url":"https://api.github.com/users/itkg-ngilain/gists{/gist_id}","starred_url":"https://api.github.com/users/itkg-ngilain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itkg-ngilain/subscriptions","organizations_url":"https://api.github.com/users/itkg-ngilain/orgs","repos_url":"https://api.github.com/users/itkg-ngilain/repos","events_url":"https://api.github.com/users/itkg-ngilain/events{/privacy}","received_events_url":"https://api.github.com/users/itkg-ngilain/received_events","type":"User","site_admin":false},"body":"https://github.com/open-orchestra/open-orchestra-display-bundle/pull/172\r\nhttps://github.com/open-orchestra/open-orchestra-media-bundle/pull/107\r\nhttps://github.com/open-orchestra/open-orchestra-cms-bundle/pull/1051\r\nhttps://github.com/open-orchestra/open-orchestra-media-admin-bundle/pull/29","created_at":"2015-09-10T16:07:54Z","updated_at":"2015-09-16T08:00:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"362375731e2f5c7a202c68c6a463fade624c94dd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/172/commits","review_comments_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/172/comments","review_comment_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/issues/172/comments","statuses_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/statuses/f86c4b02046783b6b2366a73b9253e5a82231e6b","head":{"label":"open-orchestra:use_bbcodemedia_definition","ref":"use_bbcodemedia_definition","sha":"f86c4b02046783b6b2366a73b9253e5a82231e6b","user":{"login":"open-orchestra","id":11756116,"avatar_url":"https://avatars.githubusercontent.com/u/11756116?v=3","gravatar_id":"","url":"https://api.github.com/users/open-orchestra","html_url":"https://github.com/open-orchestra","followers_url":"https://api.github.com/users/open-orchestra/followers","following_url":"https://api.github.com/users/open-orchestra/following{/other_user}","gists_url":"https://api.github.com/users/open-orchestra/gists{/gist_id}","starred_url":"https://api.github.com/users/open-orchestra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-orchestra/subscriptions","organizations_url":"https://api.github.com/users/open-orchestra/orgs","repos_url":"https://api.github.com/users/open-orchestra/repos","events_url":"https://api.github.com/users/open-orchestra/events{/privacy}","received_events_url":"https://api.github.com/users/open-orchestra/received_events","type":"Organization","site_admin":false},"repo":{"id":22645709,"name":"open-orchestra-display-bundle","full_name":"open-orchestra/open-orchestra-display-bundle","owner":{"login":"open-orchestra","id":11756116,"avatar_url":"https://avatars.githubusercontent.com/u/11756116?v=3","gravatar_id":"","url":"https://api.github.com/users/open-orchestra","html_url":"https://github.com/open-orchestra","followers_url":"https://api.github.com/users/open-orchestra/followers","following_url":"https://api.github.com/users/open-orchestra/following{/other_user}","gists_url":"https://api.github.com/users/open-orchestra/gists{/gist_id}","starred_url":"https://api.github.com/users/open-orchestra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-orchestra/subscriptions","organizations_url":"https://api.github.com/users/open-orchestra/orgs","repos_url":"https://api.github.com/users/open-orchestra/repos","events_url":"https://api.github.com/users/open-orchestra/events{/privacy}","received_events_url":"https://api.github.com/users/open-orchestra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/open-orchestra/open-orchestra-display-bundle","description":"","fork":false,"url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle","forks_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/forks","keys_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/teams","hooks_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/hooks","issue_events_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/issues/events{/number}","events_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/events","assignees_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/assignees{/user}","branches_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/branches{/branch}","tags_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/tags","blobs_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/statuses/{sha}","languages_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/languages","stargazers_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/stargazers","contributors_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/contributors","subscribers_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/subscribers","subscription_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/subscription","commits_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/contents/{+path}","compare_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/merges","archive_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/downloads","issues_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/issues{/number}","pulls_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls{/number}","milestones_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/milestones{/number}","notifications_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/labels{/name}","releases_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/releases{/id}","created_at":"2014-08-05T14:03:12Z","updated_at":"2015-07-07T15:55:45Z","pushed_at":"2015-09-15T16:45:34Z","git_url":"git://github.com/open-orchestra/open-orchestra-display-bundle.git","ssh_url":"git@github.com:open-orchestra/open-orchestra-display-bundle.git","clone_url":"https://github.com/open-orchestra/open-orchestra-display-bundle.git","svn_url":"https://github.com/open-orchestra/open-orchestra-display-bundle","homepage":null,"size":2932,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"open-orchestra:master","ref":"master","sha":"1faf9a69601b12d120a5d0620b0703fcf9507914","user":{"login":"open-orchestra","id":11756116,"avatar_url":"https://avatars.githubusercontent.com/u/11756116?v=3","gravatar_id":"","url":"https://api.github.com/users/open-orchestra","html_url":"https://github.com/open-orchestra","followers_url":"https://api.github.com/users/open-orchestra/followers","following_url":"https://api.github.com/users/open-orchestra/following{/other_user}","gists_url":"https://api.github.com/users/open-orchestra/gists{/gist_id}","starred_url":"https://api.github.com/users/open-orchestra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-orchestra/subscriptions","organizations_url":"https://api.github.com/users/open-orchestra/orgs","repos_url":"https://api.github.com/users/open-orchestra/repos","events_url":"https://api.github.com/users/open-orchestra/events{/privacy}","received_events_url":"https://api.github.com/users/open-orchestra/received_events","type":"Organization","site_admin":false},"repo":{"id":22645709,"name":"open-orchestra-display-bundle","full_name":"open-orchestra/open-orchestra-display-bundle","owner":{"login":"open-orchestra","id":11756116,"avatar_url":"https://avatars.githubusercontent.com/u/11756116?v=3","gravatar_id":"","url":"https://api.github.com/users/open-orchestra","html_url":"https://github.com/open-orchestra","followers_url":"https://api.github.com/users/open-orchestra/followers","following_url":"https://api.github.com/users/open-orchestra/following{/other_user}","gists_url":"https://api.github.com/users/open-orchestra/gists{/gist_id}","starred_url":"https://api.github.com/users/open-orchestra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-orchestra/subscriptions","organizations_url":"https://api.github.com/users/open-orchestra/orgs","repos_url":"https://api.github.com/users/open-orchestra/repos","events_url":"https://api.github.com/users/open-orchestra/events{/privacy}","received_events_url":"https://api.github.com/users/open-orchestra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/open-orchestra/open-orchestra-display-bundle","description":"","fork":false,"url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle","forks_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/forks","keys_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/teams","hooks_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/hooks","issue_events_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/issues/events{/number}","events_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/events","assignees_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/assignees{/user}","branches_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/branches{/branch}","tags_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/tags","blobs_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/statuses/{sha}","languages_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/languages","stargazers_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/stargazers","contributors_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/contributors","subscribers_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/subscribers","subscription_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/subscription","commits_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/contents/{+path}","compare_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/merges","archive_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/downloads","issues_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/issues{/number}","pulls_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls{/number}","milestones_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/milestones{/number}","notifications_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/labels{/name}","releases_url":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/releases{/id}","created_at":"2014-08-05T14:03:12Z","updated_at":"2015-07-07T15:55:45Z","pushed_at":"2015-09-15T16:45:34Z","git_url":"git://github.com/open-orchestra/open-orchestra-display-bundle.git","ssh_url":"git@github.com:open-orchestra/open-orchestra-display-bundle.git","clone_url":"https://github.com/open-orchestra/open-orchestra-display-bundle.git","svn_url":"https://github.com/open-orchestra/open-orchestra-display-bundle","homepage":null,"size":2932,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/172"},"html":{"href":"https://github.com/open-orchestra/open-orchestra-display-bundle/pull/172"},"issue":{"href":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/issues/172"},"comments":{"href":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/issues/172/comments"},"review_comments":{"href":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/172/comments"},"review_comment":{"href":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/pulls/172/commits"},"statuses":{"href":"https://api.github.com/repos/open-orchestra/open-orchestra-display-bundle/statuses/f86c4b02046783b6b2366a73b9253e5a82231e6b"}}}}