{"action":"created","comment":{"url":"https://api.github.com/repos/freeorion/freeorion/pulls/comments/39080733","id":39080733,"diff_hunk":"@@ -0,0 +1,82 @@\n+/** \\file RichText.h \\brief Contains the RichText class that allows you\n+ to intersperse text with images.*/\n+\n+#ifndef RICHTEXT_H\n+#define RICHTEXT_H\n+\n+#include <GG/ClrConstants.h>\n+#include <GG/TextControl.h>\n+\n+#include <GG/RichText/BlockControl.h>\n+\n+namespace GG\n+{\n+\n+/** \\brief A control for showing text and images.\n+ */\n+class GG_API RichText: public Control\n+{\n+public:\n+    typedef std::map<std::string, std::string> TAG_PARAMS;\n+\n+    //! An interface for object that create block controls from tags.\n+    class IBlockControlFactory\n+    {\n+    public:\n+        //! Creates a control from the tag (with unparsed parameters) and the content between the tags.\n+        //! You own the returned control.\n+        virtual BlockControl* CreateFromTag ( const std::string& tag,\n+                                              const TAG_PARAMS& params,\n+                                              const std::string& content,\n+                                              const boost::shared_ptr<Font>& font,\n+                                              Clr color,\n+                                              Flags<TextFormat> format ) = 0;\n+    };\n+\n+    //! The type of the object where we store control factories of tags.\n+    typedef std::map<std::string, IBlockControlFactory*> BLOCK_FACTORY_MAP;\n+\n+    //! The special tag that is used to represent plaintext.\n+    // Allows you to register a custom control for displaying plaintext.\n+    static const std::string PLAINTEXT_TAG;","path":"GG/GG/RichText/RichText.h","position":41,"original_position":41,"commit_id":"f5b6c49806ecdc8893fd86b017211ea0c0d5ac10","original_commit_id":"f5b6c49806ecdc8893fd86b017211ea0c0d5ac10","user":{"login":"Mitten-O","id":8913801,"avatar_url":"https://avatars.githubusercontent.com/u/8913801?v=3","gravatar_id":"","url":"https://api.github.com/users/Mitten-O","html_url":"https://github.com/Mitten-O","followers_url":"https://api.github.com/users/Mitten-O/followers","following_url":"https://api.github.com/users/Mitten-O/following{/other_user}","gists_url":"https://api.github.com/users/Mitten-O/gists{/gist_id}","starred_url":"https://api.github.com/users/Mitten-O/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mitten-O/subscriptions","organizations_url":"https://api.github.com/users/Mitten-O/orgs","repos_url":"https://api.github.com/users/Mitten-O/repos","events_url":"https://api.github.com/users/Mitten-O/events{/privacy}","received_events_url":"https://api.github.com/users/Mitten-O/received_events","type":"User","site_admin":false},"body":"The use can override the plaintext handler, as is done in the encyclopedia to enable links.","created_at":"2015-09-09T18:45:29Z","updated_at":"2015-09-09T18:45:29Z","html_url":"https://github.com/freeorion/freeorion/pull/332#discussion_r39080733","pull_request_url":"https://api.github.com/repos/freeorion/freeorion/pulls/332","_links":{"self":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/comments/39080733"},"html":{"href":"https://github.com/freeorion/freeorion/pull/332#discussion_r39080733"},"pull_request":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/332"}}},"pull_request":{"url":"https://api.github.com/repos/freeorion/freeorion/pulls/332","id":44471608,"html_url":"https://github.com/freeorion/freeorion/pull/332","diff_url":"https://github.com/freeorion/freeorion/pull/332.diff","patch_url":"https://github.com/freeorion/freeorion/pull/332.patch","issue_url":"https://api.github.com/repos/freeorion/freeorion/issues/332","number":332,"state":"open","locked":false,"title":"Images in the encyclopedia","user":{"login":"Mitten-O","id":8913801,"avatar_url":"https://avatars.githubusercontent.com/u/8913801?v=3","gravatar_id":"","url":"https://api.github.com/users/Mitten-O","html_url":"https://github.com/Mitten-O","followers_url":"https://api.github.com/users/Mitten-O/followers","following_url":"https://api.github.com/users/Mitten-O/following{/other_user}","gists_url":"https://api.github.com/users/Mitten-O/gists{/gist_id}","starred_url":"https://api.github.com/users/Mitten-O/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mitten-O/subscriptions","organizations_url":"https://api.github.com/users/Mitten-O/orgs","repos_url":"https://api.github.com/users/Mitten-O/repos","events_url":"https://api.github.com/users/Mitten-O/events{/privacy}","received_events_url":"https://api.github.com/users/Mitten-O/received_events","type":"User","site_admin":false},"body":"Adds the capability to embed images into encyclopedia articles.\r\n\r\nIntroduces a new text control, RichText, that parses its contents\r\nfor registered tags and creates control to display them using\r\nfactories provided at tag registration.\r\n\r\nThe tag handler controls must derive from BlockControl.\r\nIt defines the contract between the blocks and th container:\r\nthe container specifies the width and the block determines its height.\r\nThis is the easiest reasonable way to flow text.\r\n\r\nThere are only two registered tags for now, img and RichText::PLAINTEXT_TAG.\r\nImageBlock is registered to handle images and TextBLock is used to handle plain text by default.\r\n\r\nIn the encyclopedia, CUILinkTextBlock is registered as the plain text handler to\r\nenable links.\r\n\r\n![fo_suitability_wheel_image](https://cloud.githubusercontent.com/assets/8913801/9744880/228971f6-5677-11e5-8fe0-58e8665a516c.png)\r\n\r\nOnly centered, native size or automatically smaller images for now.","created_at":"2015-09-08T19:17:32Z","updated_at":"2015-09-09T18:45:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"deb18ef615230ea10a15e26a58285e5709a15e80","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/freeorion/freeorion/pulls/332/commits","review_comments_url":"https://api.github.com/repos/freeorion/freeorion/pulls/332/comments","review_comment_url":"https://api.github.com/repos/freeorion/freeorion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/freeorion/freeorion/issues/332/comments","statuses_url":"https://api.github.com/repos/freeorion/freeorion/statuses/f5b6c49806ecdc8893fd86b017211ea0c0d5ac10","head":{"label":"Mitten-O:rich_text_more","ref":"rich_text_more","sha":"f5b6c49806ecdc8893fd86b017211ea0c0d5ac10","user":{"login":"Mitten-O","id":8913801,"avatar_url":"https://avatars.githubusercontent.com/u/8913801?v=3","gravatar_id":"","url":"https://api.github.com/users/Mitten-O","html_url":"https://github.com/Mitten-O","followers_url":"https://api.github.com/users/Mitten-O/followers","following_url":"https://api.github.com/users/Mitten-O/following{/other_user}","gists_url":"https://api.github.com/users/Mitten-O/gists{/gist_id}","starred_url":"https://api.github.com/users/Mitten-O/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mitten-O/subscriptions","organizations_url":"https://api.github.com/users/Mitten-O/orgs","repos_url":"https://api.github.com/users/Mitten-O/repos","events_url":"https://api.github.com/users/Mitten-O/events{/privacy}","received_events_url":"https://api.github.com/users/Mitten-O/received_events","type":"User","site_admin":false},"repo":{"id":33953402,"name":"freeorion","full_name":"Mitten-O/freeorion","owner":{"login":"Mitten-O","id":8913801,"avatar_url":"https://avatars.githubusercontent.com/u/8913801?v=3","gravatar_id":"","url":"https://api.github.com/users/Mitten-O","html_url":"https://github.com/Mitten-O","followers_url":"https://api.github.com/users/Mitten-O/followers","following_url":"https://api.github.com/users/Mitten-O/following{/other_user}","gists_url":"https://api.github.com/users/Mitten-O/gists{/gist_id}","starred_url":"https://api.github.com/users/Mitten-O/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mitten-O/subscriptions","organizations_url":"https://api.github.com/users/Mitten-O/orgs","repos_url":"https://api.github.com/users/Mitten-O/repos","events_url":"https://api.github.com/users/Mitten-O/events{/privacy}","received_events_url":"https://api.github.com/users/Mitten-O/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mitten-O/freeorion","description":"Source code repository of the FreeOrion project.","fork":true,"url":"https://api.github.com/repos/Mitten-O/freeorion","forks_url":"https://api.github.com/repos/Mitten-O/freeorion/forks","keys_url":"https://api.github.com/repos/Mitten-O/freeorion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mitten-O/freeorion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mitten-O/freeorion/teams","hooks_url":"https://api.github.com/repos/Mitten-O/freeorion/hooks","issue_events_url":"https://api.github.com/repos/Mitten-O/freeorion/issues/events{/number}","events_url":"https://api.github.com/repos/Mitten-O/freeorion/events","assignees_url":"https://api.github.com/repos/Mitten-O/freeorion/assignees{/user}","branches_url":"https://api.github.com/repos/Mitten-O/freeorion/branches{/branch}","tags_url":"https://api.github.com/repos/Mitten-O/freeorion/tags","blobs_url":"https://api.github.com/repos/Mitten-O/freeorion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mitten-O/freeorion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mitten-O/freeorion/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mitten-O/freeorion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mitten-O/freeorion/statuses/{sha}","languages_url":"https://api.github.com/repos/Mitten-O/freeorion/languages","stargazers_url":"https://api.github.com/repos/Mitten-O/freeorion/stargazers","contributors_url":"https://api.github.com/repos/Mitten-O/freeorion/contributors","subscribers_url":"https://api.github.com/repos/Mitten-O/freeorion/subscribers","subscription_url":"https://api.github.com/repos/Mitten-O/freeorion/subscription","commits_url":"https://api.github.com/repos/Mitten-O/freeorion/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mitten-O/freeorion/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mitten-O/freeorion/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mitten-O/freeorion/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mitten-O/freeorion/contents/{+path}","compare_url":"https://api.github.com/repos/Mitten-O/freeorion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mitten-O/freeorion/merges","archive_url":"https://api.github.com/repos/Mitten-O/freeorion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mitten-O/freeorion/downloads","issues_url":"https://api.github.com/repos/Mitten-O/freeorion/issues{/number}","pulls_url":"https://api.github.com/repos/Mitten-O/freeorion/pulls{/number}","milestones_url":"https://api.github.com/repos/Mitten-O/freeorion/milestones{/number}","notifications_url":"https://api.github.com/repos/Mitten-O/freeorion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mitten-O/freeorion/labels{/name}","releases_url":"https://api.github.com/repos/Mitten-O/freeorion/releases{/id}","created_at":"2015-04-14T19:49:23Z","updated_at":"2015-04-15T18:47:09Z","pushed_at":"2015-09-08T19:09:12Z","git_url":"git://github.com/Mitten-O/freeorion.git","ssh_url":"git@github.com:Mitten-O/freeorion.git","clone_url":"https://github.com/Mitten-O/freeorion.git","svn_url":"https://github.com/Mitten-O/freeorion","homepage":"http://www.freeorion.org/","size":481662,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"freeorion:master","ref":"master","sha":"0868ed4c24030d9b9108f96950d59fde2b0537c4","user":{"login":"freeorion","id":1025550,"avatar_url":"https://avatars.githubusercontent.com/u/1025550?v=3","gravatar_id":"","url":"https://api.github.com/users/freeorion","html_url":"https://github.com/freeorion","followers_url":"https://api.github.com/users/freeorion/followers","following_url":"https://api.github.com/users/freeorion/following{/other_user}","gists_url":"https://api.github.com/users/freeorion/gists{/gist_id}","starred_url":"https://api.github.com/users/freeorion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freeorion/subscriptions","organizations_url":"https://api.github.com/users/freeorion/orgs","repos_url":"https://api.github.com/users/freeorion/repos","events_url":"https://api.github.com/users/freeorion/events{/privacy}","received_events_url":"https://api.github.com/users/freeorion/received_events","type":"Organization","site_admin":false},"repo":{"id":33066062,"name":"freeorion","full_name":"freeorion/freeorion","owner":{"login":"freeorion","id":1025550,"avatar_url":"https://avatars.githubusercontent.com/u/1025550?v=3","gravatar_id":"","url":"https://api.github.com/users/freeorion","html_url":"https://github.com/freeorion","followers_url":"https://api.github.com/users/freeorion/followers","following_url":"https://api.github.com/users/freeorion/following{/other_user}","gists_url":"https://api.github.com/users/freeorion/gists{/gist_id}","starred_url":"https://api.github.com/users/freeorion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freeorion/subscriptions","organizations_url":"https://api.github.com/users/freeorion/orgs","repos_url":"https://api.github.com/users/freeorion/repos","events_url":"https://api.github.com/users/freeorion/events{/privacy}","received_events_url":"https://api.github.com/users/freeorion/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/freeorion/freeorion","description":"Source code repository of the FreeOrion project.","fork":false,"url":"https://api.github.com/repos/freeorion/freeorion","forks_url":"https://api.github.com/repos/freeorion/freeorion/forks","keys_url":"https://api.github.com/repos/freeorion/freeorion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/freeorion/freeorion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/freeorion/freeorion/teams","hooks_url":"https://api.github.com/repos/freeorion/freeorion/hooks","issue_events_url":"https://api.github.com/repos/freeorion/freeorion/issues/events{/number}","events_url":"https://api.github.com/repos/freeorion/freeorion/events","assignees_url":"https://api.github.com/repos/freeorion/freeorion/assignees{/user}","branches_url":"https://api.github.com/repos/freeorion/freeorion/branches{/branch}","tags_url":"https://api.github.com/repos/freeorion/freeorion/tags","blobs_url":"https://api.github.com/repos/freeorion/freeorion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/freeorion/freeorion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/freeorion/freeorion/git/refs{/sha}","trees_url":"https://api.github.com/repos/freeorion/freeorion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/freeorion/freeorion/statuses/{sha}","languages_url":"https://api.github.com/repos/freeorion/freeorion/languages","stargazers_url":"https://api.github.com/repos/freeorion/freeorion/stargazers","contributors_url":"https://api.github.com/repos/freeorion/freeorion/contributors","subscribers_url":"https://api.github.com/repos/freeorion/freeorion/subscribers","subscription_url":"https://api.github.com/repos/freeorion/freeorion/subscription","commits_url":"https://api.github.com/repos/freeorion/freeorion/commits{/sha}","git_commits_url":"https://api.github.com/repos/freeorion/freeorion/git/commits{/sha}","comments_url":"https://api.github.com/repos/freeorion/freeorion/comments{/number}","issue_comment_url":"https://api.github.com/repos/freeorion/freeorion/issues/comments{/number}","contents_url":"https://api.github.com/repos/freeorion/freeorion/contents/{+path}","compare_url":"https://api.github.com/repos/freeorion/freeorion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/freeorion/freeorion/merges","archive_url":"https://api.github.com/repos/freeorion/freeorion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/freeorion/freeorion/downloads","issues_url":"https://api.github.com/repos/freeorion/freeorion/issues{/number}","pulls_url":"https://api.github.com/repos/freeorion/freeorion/pulls{/number}","milestones_url":"https://api.github.com/repos/freeorion/freeorion/milestones{/number}","notifications_url":"https://api.github.com/repos/freeorion/freeorion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/freeorion/freeorion/labels{/name}","releases_url":"https://api.github.com/repos/freeorion/freeorion/releases{/id}","created_at":"2015-03-29T08:22:20Z","updated_at":"2015-09-09T10:57:57Z","pushed_at":"2015-09-09T18:37:18Z","git_url":"git://github.com/freeorion/freeorion.git","ssh_url":"git@github.com:freeorion/freeorion.git","clone_url":"https://github.com/freeorion/freeorion.git","svn_url":"https://github.com/freeorion/freeorion","homepage":"http://www.freeorion.org/","size":501910,"stargazers_count":80,"watchers_count":80,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":17,"forks":37,"open_issues":17,"watchers":80,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/332"},"html":{"href":"https://github.com/freeorion/freeorion/pull/332"},"issue":{"href":"https://api.github.com/repos/freeorion/freeorion/issues/332"},"comments":{"href":"https://api.github.com/repos/freeorion/freeorion/issues/332/comments"},"review_comments":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/332/comments"},"review_comment":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/332/commits"},"statuses":{"href":"https://api.github.com/repos/freeorion/freeorion/statuses/f5b6c49806ecdc8893fd86b017211ea0c0d5ac10"}}}}