{"action":"created","comment":{"url":"https://api.github.com/repos/Techprimate/TPPDF/pulls/comments/178518743","pull_request_review_id":108585246,"id":178518743,"diff_hunk":"@@ -0,0 +1,176 @@\n+//\n+//  PDFGenerator+TableInline.swift\n+//  Pods\n+//\n+//  Created by Marco Betschart on 02.04.18.\n+//\n+\n+extension PDFGenerator {\n+\t\n+\tfunc drawTableInline(_ container: Container, data: [[String]], alignments: [[TableCellAlignment]], relativeColumnWidth: [CGFloat], padding: CGFloat, margin: CGFloat, style: TableStyle, newPageBreak: Bool = false, styleIndexOffset: Int = 0) {\n+\t\tassert(data.count != 0, \"You can't draw an table without rows!\")\n+\t\tassert(data.count == alignments.count, \"Data and alignment array must be equal size!\")\n+\t\tfor (rowIdx, row) in data.enumerated() {\n+\t\t\tassert(row.count == alignments[rowIdx].count, \"Data and alignment for row with index \\(rowIdx) does not have the same amount!\")\n+\t\t\tassert(row.count == relativeColumnWidth.count, \"Data and alignment for row with index \\(rowIdx) does not have the same amount!\")\n+\t\t}\n+\t\t\n+\t\tlet totalWidth = pageBounds.width - 2 * pageMargin - indentation[container.normalize]!\n+\t\tvar x: CGFloat\n+\t\tif container != .contentRight {\n+\t\t\tx = pageMargin + indentation[container.normalize]!\n+\t\t} else {\n+\t\t\tx = pageBounds.size.width * relativeColumnWidth.reduce(0.0){ $0 + $1 }\n+\t\t}\n+\t\tvar y: CGFloat = contentHeight - contentHeightInline\n+\t\t\n+\t\t// Calculate cells\n+\t\t\n+\t\tvar cellFrames: [[CGRect]] = []\n+\t\tvar frames: [[CGRect]] = []\n+\t\t\n+\t\tfor (rowIdx, row) in data.enumerated() {\n+\t\t\tframes.append([])\n+\t\t\tcellFrames.append([])\n+\t\t\t\n+\t\t\tvar maxHeight: CGFloat = 0\n+\t\t\t\n+\t\t\t// Calcuate X position and size\n+\t\t\tfor (colIdx, column) in row.enumerated() {\n+\t\t\t\tlet cellStyle = getCellStyle(tableHeight: data.count + styleIndexOffset, style: style, row: styleIndexOffset + rowIdx, column: colIdx, newPageBreak: newPageBreak)\n+\t\t\t\tlet attributes: [String: AnyObject] = [\n+\t\t\t\t\tNSForegroundColorAttributeName: cellStyle.textColor,\n+\t\t\t\t\tNSFontAttributeName: cellStyle.font\n+\t\t\t\t]\n+\t\t\t\t\n+\t\t\t\tlet text = NSAttributedString(string: column, attributes: attributes)\n+\t\t\t\tlet width = relativeColumnWidth[colIdx] * totalWidth\n+\t\t\t\tlet result = calculateCellFrame(CGPoint(x: x + margin + padding, y: y + maxHeaderHeight() + headerSpace + margin + padding), width: width - 2 * margin - 2 * padding, text: text, alignment: alignments[rowIdx][colIdx])\n+\t\t\t\t\n+\t\t\t\tmaxHeight = max(maxHeight, result.height)\n+\t\t\t\tframes[rowIdx].append(result)\n+\t\t\t\t\n+\t\t\t\tlet cellFrame = CGRect(x: x + margin, y: y + maxHeaderHeight() + headerSpace + margin, width: width - 2 * margin, height: result.height);","path":"Sources/PDFGenerator+TableInline.swift","position":53,"original_position":53,"commit_id":"2f35a40e36312b5385b21365c4e7e90f0da66af7","original_commit_id":"2f35a40e36312b5385b21365c4e7e90f0da66af7","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [Statements should not terminate with a semicolon](https://app.codacy.com/app/techprimate-phil/TPPDF/pullRequest?prid=1489861)","created_at":"2018-04-02T09:58:29Z","updated_at":"2018-04-02T09:58:30Z","html_url":"https://github.com/Techprimate/TPPDF/pull/51#discussion_r178518743","pull_request_url":"https://api.github.com/repos/Techprimate/TPPDF/pulls/51","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/Techprimate/TPPDF/pulls/comments/178518743"},"html":{"href":"https://github.com/Techprimate/TPPDF/pull/51#discussion_r178518743"},"pull_request":{"href":"https://api.github.com/repos/Techprimate/TPPDF/pulls/51"}}},"pull_request":{"url":"https://api.github.com/repos/Techprimate/TPPDF/pulls/51","id":178288961,"html_url":"https://github.com/Techprimate/TPPDF/pull/51","diff_url":"https://github.com/Techprimate/TPPDF/pull/51.diff","patch_url":"https://github.com/Techprimate/TPPDF/pull/51.patch","issue_url":"https://api.github.com/repos/Techprimate/TPPDF/issues/51","number":51,"state":"open","locked":false,"title":"Basic Inline commands","user":{"login":"marbetschar","id":392542,"avatar_url":"https://avatars3.githubusercontent.com/u/392542?v=4","gravatar_id":"","url":"https://api.github.com/users/marbetschar","html_url":"https://github.com/marbetschar","followers_url":"https://api.github.com/users/marbetschar/followers","following_url":"https://api.github.com/users/marbetschar/following{/other_user}","gists_url":"https://api.github.com/users/marbetschar/gists{/gist_id}","starred_url":"https://api.github.com/users/marbetschar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marbetschar/subscriptions","organizations_url":"https://api.github.com/users/marbetschar/orgs","repos_url":"https://api.github.com/users/marbetschar/repos","events_url":"https://api.github.com/users/marbetschar/events{/privacy}","received_events_url":"https://api.github.com/users/marbetschar/received_events","type":"User","site_admin":false},"body":"Added basic inline commands (`addTextInline` as well as `addImageInline`) to place images as well as text next to each other on the same line. \r\n\r\nThis pull requests works around current limitations mentioned in https://github.com/Techprimate/TPPDF/issues/50\r\n\r\n<img width=\"327\" alt=\"bildschirmfoto 2018-03-29 um 12 20 56\" src=\"https://user-images.githubusercontent.com/392542/38084255-71e6bf6a-334c-11e8-88b8-84c73b14ecd7.png\">\r\n\r\n\r\nPlease note that this does not work 100% under every circumstances. Known limitations:\r\n- Inline items can only be added to content containers (`.contentLeft`,`.contentCenter` and `.contentRight`)\r\n- Adding multiple inline items to the same container is not supported - except you have a block element in between (e.g.: `.addTextInline(.contentLeft, ...), .addSpace(), .addTextInline(.contentLeft, ...)`\r\n- Image captions are not supported\r\n\r\nFor now it works good enough [till the rewrite of the new version is complete](https://github.com/Techprimate/TPPDF/issues/29). Hopefully inline items will be supported in the new version?","created_at":"2018-03-29T10:31:36Z","updated_at":"2018-04-02T09:58:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b1b7e77113e3db812e68b94b83f967314539a67","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Techprimate/TPPDF/pulls/51/commits","review_comments_url":"https://api.github.com/repos/Techprimate/TPPDF/pulls/51/comments","review_comment_url":"https://api.github.com/repos/Techprimate/TPPDF/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Techprimate/TPPDF/issues/51/comments","statuses_url":"https://api.github.com/repos/Techprimate/TPPDF/statuses/2f35a40e36312b5385b21365c4e7e90f0da66af7","head":{"label":"Mandelkind:inline-items","ref":"inline-items","sha":"2f35a40e36312b5385b21365c4e7e90f0da66af7","user":{"login":"Mandelkind","id":5818368,"avatar_url":"https://avatars2.githubusercontent.com/u/5818368?v=4","gravatar_id":"","url":"https://api.github.com/users/Mandelkind","html_url":"https://github.com/Mandelkind","followers_url":"https://api.github.com/users/Mandelkind/followers","following_url":"https://api.github.com/users/Mandelkind/following{/other_user}","gists_url":"https://api.github.com/users/Mandelkind/gists{/gist_id}","starred_url":"https://api.github.com/users/Mandelkind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mandelkind/subscriptions","organizations_url":"https://api.github.com/users/Mandelkind/orgs","repos_url":"https://api.github.com/users/Mandelkind/repos","events_url":"https://api.github.com/users/Mandelkind/events{/privacy}","received_events_url":"https://api.github.com/users/Mandelkind/received_events","type":"Organization","site_admin":false},"repo":{"id":127266730,"name":"TPPDF","full_name":"Mandelkind/TPPDF","owner":{"login":"Mandelkind","id":5818368,"avatar_url":"https://avatars2.githubusercontent.com/u/5818368?v=4","gravatar_id":"","url":"https://api.github.com/users/Mandelkind","html_url":"https://github.com/Mandelkind","followers_url":"https://api.github.com/users/Mandelkind/followers","following_url":"https://api.github.com/users/Mandelkind/following{/other_user}","gists_url":"https://api.github.com/users/Mandelkind/gists{/gist_id}","starred_url":"https://api.github.com/users/Mandelkind/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mandelkind/subscriptions","organizations_url":"https://api.github.com/users/Mandelkind/orgs","repos_url":"https://api.github.com/users/Mandelkind/repos","events_url":"https://api.github.com/users/Mandelkind/events{/privacy}","received_events_url":"https://api.github.com/users/Mandelkind/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Mandelkind/TPPDF","description":"TPPDF is a simple-to-use PDF builder for iOS","fork":true,"url":"https://api.github.com/repos/Mandelkind/TPPDF","forks_url":"https://api.github.com/repos/Mandelkind/TPPDF/forks","keys_url":"https://api.github.com/repos/Mandelkind/TPPDF/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mandelkind/TPPDF/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mandelkind/TPPDF/teams","hooks_url":"https://api.github.com/repos/Mandelkind/TPPDF/hooks","issue_events_url":"https://api.github.com/repos/Mandelkind/TPPDF/issues/events{/number}","events_url":"https://api.github.com/repos/Mandelkind/TPPDF/events","assignees_url":"https://api.github.com/repos/Mandelkind/TPPDF/assignees{/user}","branches_url":"https://api.github.com/repos/Mandelkind/TPPDF/branches{/branch}","tags_url":"https://api.github.com/repos/Mandelkind/TPPDF/tags","blobs_url":"https://api.github.com/repos/Mandelkind/TPPDF/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mandelkind/TPPDF/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mandelkind/TPPDF/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mandelkind/TPPDF/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mandelkind/TPPDF/statuses/{sha}","languages_url":"https://api.github.com/repos/Mandelkind/TPPDF/languages","stargazers_url":"https://api.github.com/repos/Mandelkind/TPPDF/stargazers","contributors_url":"https://api.github.com/repos/Mandelkind/TPPDF/contributors","subscribers_url":"https://api.github.com/repos/Mandelkind/TPPDF/subscribers","subscription_url":"https://api.github.com/repos/Mandelkind/TPPDF/subscription","commits_url":"https://api.github.com/repos/Mandelkind/TPPDF/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mandelkind/TPPDF/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mandelkind/TPPDF/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mandelkind/TPPDF/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mandelkind/TPPDF/contents/{+path}","compare_url":"https://api.github.com/repos/Mandelkind/TPPDF/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mandelkind/TPPDF/merges","archive_url":"https://api.github.com/repos/Mandelkind/TPPDF/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mandelkind/TPPDF/downloads","issues_url":"https://api.github.com/repos/Mandelkind/TPPDF/issues{/number}","pulls_url":"https://api.github.com/repos/Mandelkind/TPPDF/pulls{/number}","milestones_url":"https://api.github.com/repos/Mandelkind/TPPDF/milestones{/number}","notifications_url":"https://api.github.com/repos/Mandelkind/TPPDF/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mandelkind/TPPDF/labels{/name}","releases_url":"https://api.github.com/repos/Mandelkind/TPPDF/releases{/id}","deployments_url":"https://api.github.com/repos/Mandelkind/TPPDF/deployments","created_at":"2018-03-29T09:10:20Z","updated_at":"2018-03-29T09:10:22Z","pushed_at":"2018-04-02T09:00:34Z","git_url":"git://github.com/Mandelkind/TPPDF.git","ssh_url":"git@github.com:Mandelkind/TPPDF.git","clone_url":"https://github.com/Mandelkind/TPPDF.git","svn_url":"https://github.com/Mandelkind/TPPDF","homepage":"","size":12711,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Techprimate:master","ref":"master","sha":"1173138e95b9f95691272128bc2db2e9a9ae0589","user":{"login":"Techprimate","id":4140457,"avatar_url":"https://avatars3.githubusercontent.com/u/4140457?v=4","gravatar_id":"","url":"https://api.github.com/users/Techprimate","html_url":"https://github.com/Techprimate","followers_url":"https://api.github.com/users/Techprimate/followers","following_url":"https://api.github.com/users/Techprimate/following{/other_user}","gists_url":"https://api.github.com/users/Techprimate/gists{/gist_id}","starred_url":"https://api.github.com/users/Techprimate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Techprimate/subscriptions","organizations_url":"https://api.github.com/users/Techprimate/orgs","repos_url":"https://api.github.com/users/Techprimate/repos","events_url":"https://api.github.com/users/Techprimate/events{/privacy}","received_events_url":"https://api.github.com/users/Techprimate/received_events","type":"Organization","site_admin":false},"repo":{"id":65774775,"name":"TPPDF","full_name":"Techprimate/TPPDF","owner":{"login":"Techprimate","id":4140457,"avatar_url":"https://avatars3.githubusercontent.com/u/4140457?v=4","gravatar_id":"","url":"https://api.github.com/users/Techprimate","html_url":"https://github.com/Techprimate","followers_url":"https://api.github.com/users/Techprimate/followers","following_url":"https://api.github.com/users/Techprimate/following{/other_user}","gists_url":"https://api.github.com/users/Techprimate/gists{/gist_id}","starred_url":"https://api.github.com/users/Techprimate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Techprimate/subscriptions","organizations_url":"https://api.github.com/users/Techprimate/orgs","repos_url":"https://api.github.com/users/Techprimate/repos","events_url":"https://api.github.com/users/Techprimate/events{/privacy}","received_events_url":"https://api.github.com/users/Techprimate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Techprimate/TPPDF","description":"TPPDF is a simple-to-use PDF builder for iOS","fork":false,"url":"https://api.github.com/repos/Techprimate/TPPDF","forks_url":"https://api.github.com/repos/Techprimate/TPPDF/forks","keys_url":"https://api.github.com/repos/Techprimate/TPPDF/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Techprimate/TPPDF/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Techprimate/TPPDF/teams","hooks_url":"https://api.github.com/repos/Techprimate/TPPDF/hooks","issue_events_url":"https://api.github.com/repos/Techprimate/TPPDF/issues/events{/number}","events_url":"https://api.github.com/repos/Techprimate/TPPDF/events","assignees_url":"https://api.github.com/repos/Techprimate/TPPDF/assignees{/user}","branches_url":"https://api.github.com/repos/Techprimate/TPPDF/branches{/branch}","tags_url":"https://api.github.com/repos/Techprimate/TPPDF/tags","blobs_url":"https://api.github.com/repos/Techprimate/TPPDF/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Techprimate/TPPDF/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Techprimate/TPPDF/git/refs{/sha}","trees_url":"https://api.github.com/repos/Techprimate/TPPDF/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Techprimate/TPPDF/statuses/{sha}","languages_url":"https://api.github.com/repos/Techprimate/TPPDF/languages","stargazers_url":"https://api.github.com/repos/Techprimate/TPPDF/stargazers","contributors_url":"https://api.github.com/repos/Techprimate/TPPDF/contributors","subscribers_url":"https://api.github.com/repos/Techprimate/TPPDF/subscribers","subscription_url":"https://api.github.com/repos/Techprimate/TPPDF/subscription","commits_url":"https://api.github.com/repos/Techprimate/TPPDF/commits{/sha}","git_commits_url":"https://api.github.com/repos/Techprimate/TPPDF/git/commits{/sha}","comments_url":"https://api.github.com/repos/Techprimate/TPPDF/comments{/number}","issue_comment_url":"https://api.github.com/repos/Techprimate/TPPDF/issues/comments{/number}","contents_url":"https://api.github.com/repos/Techprimate/TPPDF/contents/{+path}","compare_url":"https://api.github.com/repos/Techprimate/TPPDF/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Techprimate/TPPDF/merges","archive_url":"https://api.github.com/repos/Techprimate/TPPDF/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Techprimate/TPPDF/downloads","issues_url":"https://api.github.com/repos/Techprimate/TPPDF/issues{/number}","pulls_url":"https://api.github.com/repos/Techprimate/TPPDF/pulls{/number}","milestones_url":"https://api.github.com/repos/Techprimate/TPPDF/milestones{/number}","notifications_url":"https://api.github.com/repos/Techprimate/TPPDF/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Techprimate/TPPDF/labels{/name}","releases_url":"https://api.github.com/repos/Techprimate/TPPDF/releases{/id}","deployments_url":"https://api.github.com/repos/Techprimate/TPPDF/deployments","created_at":"2016-08-16T00:43:33Z","updated_at":"2018-03-27T16:30:55Z","pushed_at":"2018-04-02T09:00:36Z","git_url":"git://github.com/Techprimate/TPPDF.git","ssh_url":"git@github.com:Techprimate/TPPDF.git","clone_url":"https://github.com/Techprimate/TPPDF.git","svn_url":"https://github.com/Techprimate/TPPDF","homepage":"","size":12747,"stargazers_count":172,"watchers_count":172,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":33,"open_issues":20,"watchers":172,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Techprimate/TPPDF/pulls/51"},"html":{"href":"https://github.com/Techprimate/TPPDF/pull/51"},"issue":{"href":"https://api.github.com/repos/Techprimate/TPPDF/issues/51"},"comments":{"href":"https://api.github.com/repos/Techprimate/TPPDF/issues/51/comments"},"review_comments":{"href":"https://api.github.com/repos/Techprimate/TPPDF/pulls/51/comments"},"review_comment":{"href":"https://api.github.com/repos/Techprimate/TPPDF/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Techprimate/TPPDF/pulls/51/commits"},"statuses":{"href":"https://api.github.com/repos/Techprimate/TPPDF/statuses/2f35a40e36312b5385b21365c4e7e90f0da66af7"}},"author_association":"NONE"}}
{"actor":{"display_login":"codacy-bot"}}