{"action":"created","comment":{"url":"https://api.github.com/repos/zotero/translators/pulls/comments/94092267","pull_request_review_id":14622945,"id":94092267,"diff_hunk":"@@ -0,0 +1,980 @@\n+{\n+\t\"translatorID\": \"e7243cef-a709-4a46-ba46-1b1318051bec\",\n+\t\"label\": \"Citavi 5 XML\",\n+\t\"creator\": \"Philipp Zumstein\",\n+\t\"target\": \"xml\",\n+\t\"minVersion\": \"3.0\",\n+\t\"maxVersion\": \"\",\n+\t\"priority\": 100,\n+\t\"configOptions\": {\n+\t\t\"dataMode\": \"xml/dom\"\n+\t},\n+\t\"inRepository\": true,\n+\t\"translatorType\": 1,\n+\t\"browserSupport\": \"gcsi\",\n+\t\"lastUpdated\": \"2016-12-05 17:59:47\"\n+}\n+\n+/*\n+\t***** BEGIN LICENSE BLOCK *****\n+\t\n+\tCopyright © 2016 Philipp Zumstein\n+\t\n+\tThis file is part of Zotero.\n+\t\n+\tZotero is free software: you can redistribute it and/or modify\n+\tit under the terms of the GNU Affero General Public License as published by\n+\tthe Free Software Foundation, either version 3 of the License, or\n+\t(at your option) any later version.\n+\t\n+\tZotero is distributed in the hope that it will be useful,\n+\tbut WITHOUT ANY WARRANTY; without even the implied warranty of\n+\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+\tGNU Affero General Public License for more details.\n+\t\n+\tYou should have received a copy of the GNU Affero General Public License\n+\talong with Zotero. If not, see <http://www.gnu.org/licenses/>.\n+\t\n+\t***** END LICENSE BLOCK *****\n+*/\n+\n+\n+function detectImport() {\n+\tvar text = Zotero.read(1000);\n+\treturn text.indexOf(\"<CitaviExchangeData\") != -1;\n+}\n+\n+//This maps the Citavi types to the Zotero types.\n+//https://www.citavi.com/sub/manual5/en/referencetypeselectiondialog.html\n+var typeMapping = {\n+\t\"ArchiveMaterial\" : \"manuscript\", //Archivgut\n+\t\"AudioBook\" : \"book\", //Hörbuch\n+\t\"AudioOrVideoDocument\" : \"document\", //Ton- oder Filmdokument\n+\t\"Book\" : \"book\", //Buch (Monographie)\n+\t\"BookEdited\" : \"book\", //Buch (Sammelwerk)\n+\t\"Broadcast\" : \"tvBroadcast\", //Radio- oder Fernsehsendung\n+\t\"CollectedWorks\" : \"book\", //Schriften eines Autors\n+\t\"ComputerProgram\" : \"computerProgram\", //Software\n+\t\"ConferenceProceedings\" : \"book\", //Tagungsband\n+\t\"Contribution\" : \"bookSection\", //Beitrag in ...\n+\t\"ContributionInLegalCommentary\" : \"bookSection\", //Beitrag in Gesetzeskommentar\n+\t\"CourtDecision\" : \"case\", //Gerichtsentscheid\n+\t\"File\" : \"manuscript\", //Akte\n+\t\"InternetDocument\" : \"webpage\", //Internetdokument\n+\t\"InterviewMaterial\" : \"interview\", //Interviewmaterial\n+\t\"JournalArticle\" : \"journalArticle\", //Zeitschriftenaufsatz\n+\t\"Lecture\" : \"presentation\", //Vortrag\n+\t\"LegalCommentary\" : \"book\", //Gesetzeskommentar\n+\t\"Manuscript\" : \"manuscript\", //Manuskript\n+\t\"Map\" : \"map\", //Geographische Karte\n+\t\"Movie\" : \"videoRecording\", //Spielfilm\n+\t\"MusicTrack\" : \"audioRecording\", //Musiktitel in ...\n+\t\"MusicAlbum\" : \"audioRecording\", //Musikwerk / Musikalbum\n+\t\"NewsAgencyReport\" : \"report\", //Agenturmeldung\n+\t\"NewspaperArticle\" : \"newspaperArticle\", //Zeitungsartikel\n+\t\"Patent\" : \"patent\", //Patentschrift\n+\t\"PersonalCommunication\" : \"email\", //Persönliche Mitteilung\n+\t\"PressRelease\" : \"report\", //Pressemitteilung\n+\t\"RadioPlay\" : \"podcast\", //Hörspiel\n+\t\"SpecialIssue\" : \"book\", //Sonderheft, Beiheft\n+\t\"Standard\" : \"report\", //Norm\n+\t\"StatuteOrRegulation\" : \"statute\", //Gesetz / Verordnung\n+\t\"Thesis\" : \"thesis\", //Hochschulschrift\n+\t\"Unknown\" : \"document\", //Unklarer Dokumententyp\n+\t\"UnpublishedWork\" : \"report\" //Graue Literatur / Bericht / Report\n+};\n+\n+\n+function doImport() {\n+\tvar doc = Zotero.getXML();\n+\t\n+\t//Groups will also be mapped to tags which can be assigned to\n+\t//items or notes.\n+\tvar groups = ZU.xpath(doc, '//Groups/Group');\n+\tvar rememberTags = {};\n+\tfor (var i=0; i<groups.length; i++) {\n+\t\tvar id = ZU.xpathText(groups[i], './@id');\n+\t\tvar name = ZU.xpathText(groups[i], './Name');\n+\t\tvar referenceGroups = ZU.xpath(doc, '//ReferenceGroups/OnetoN[contains(text(), \"'+id+'\")]|//KnowledgeItemGroups/OnetoN[contains(text(), \"'+id+'\")]');\n+\t\tfor (var j=0; j<referenceGroups.length; j++) {\n+\t\t\tvar refid = referenceGroups[j].textContent.split(';')[0];\n+\t\t\tif (rememberTags[refid]) {\n+\t\t\t\trememberTags[refid].push(name);\n+\t\t\t} else {\n+\t\t\t\trememberTags[refid] = [name];\n+\t\t\t}\n+\t\t}\n+\t}\n+\t\n+\t//Main information for each reference.\n+\tvar item;\n+\tvar references = ZU.xpath(doc, '//References/Reference');\n+\tvar unfinishedReferences = [];\n+\tvar itemIdList = {};\n+\tfor (var i=0, n=references.length; i<n; i++) {\n+\t\tvar type = ZU.xpathText(references[i], 'ReferenceType');\n+\t\tif (type && typeMapping[type]) {\n+\t\t\titem = new Zotero.Item(typeMapping[type]);\n+\t\t} else {\n+\t\t\tZ.debug(\"Not yet supported type: \" + type);\n+\t\t\tZ.debug(\"Therefore use default type 'journalArticle'\");\n+\t\t\titem = new Zotero.Item(\"journalArticle\");\n+\t\t}\n+\t\titem.itemID = ZU.xpathText(references[i], './@id');","path":"Citavi 5 XML.js","position":123,"original_position":123,"commit_id":"f0488a39d46a5893f3b3bf51c67ad0a414710e2b","original_commit_id":"f0488a39d46a5893f3b3bf51c67ad0a414710e2b","user":{"login":"zuphilip","id":5199995,"avatar_url":"https://avatars.githubusercontent.com/u/5199995?v=3","gravatar_id":"","url":"https://api.github.com/users/zuphilip","html_url":"https://github.com/zuphilip","followers_url":"https://api.github.com/users/zuphilip/followers","following_url":"https://api.github.com/users/zuphilip/following{/other_user}","gists_url":"https://api.github.com/users/zuphilip/gists{/gist_id}","starred_url":"https://api.github.com/users/zuphilip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zuphilip/subscriptions","organizations_url":"https://api.github.com/users/zuphilip/orgs","repos_url":"https://api.github.com/users/zuphilip/repos","events_url":"https://api.github.com/users/zuphilip/events{/privacy}","received_events_url":"https://api.github.com/users/zuphilip/received_events","type":"User","site_admin":false},"body":"They are needed for the `seeAlso`. (Moreover, I used them internally for several things.)","created_at":"2016-12-29T00:51:35Z","updated_at":"2016-12-29T00:51:35Z","html_url":"https://github.com/zotero/translators/pull/1189#discussion_r94092267","pull_request_url":"https://api.github.com/repos/zotero/translators/pulls/1189","_links":{"self":{"href":"https://api.github.com/repos/zotero/translators/pulls/comments/94092267"},"html":{"href":"https://github.com/zotero/translators/pull/1189#discussion_r94092267"},"pull_request":{"href":"https://api.github.com/repos/zotero/translators/pulls/1189"}}},"pull_request":{"url":"https://api.github.com/repos/zotero/translators/pulls/1189","id":95371695,"html_url":"https://github.com/zotero/translators/pull/1189","diff_url":"https://github.com/zotero/translators/pull/1189.diff","patch_url":"https://github.com/zotero/translators/pull/1189.patch","issue_url":"https://api.github.com/repos/zotero/translators/issues/1189","number":1189,"state":"open","locked":false,"title":"New import translator: Citavi 5 XML.js","user":{"login":"zuphilip","id":5199995,"avatar_url":"https://avatars.githubusercontent.com/u/5199995?v=3","gravatar_id":"","url":"https://api.github.com/users/zuphilip","html_url":"https://github.com/zuphilip","followers_url":"https://api.github.com/users/zuphilip/followers","following_url":"https://api.github.com/users/zuphilip/following{/other_user}","gists_url":"https://api.github.com/users/zuphilip/gists{/gist_id}","starred_url":"https://api.github.com/users/zuphilip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zuphilip/subscriptions","organizations_url":"https://api.github.com/users/zuphilip/orgs","repos_url":"https://api.github.com/users/zuphilip/repos","events_url":"https://api.github.com/users/zuphilip/events{/privacy}","received_events_url":"https://api.github.com/users/zuphilip/received_events","type":"User","site_admin":false},"body":"This is just a first try for an import translator for the Citavi 5 XML format, which the user can have when the make a backup save in Citavi (and unzip this `ctv5bak` file).\r\n\r\nThe PR is to have some place to discuss.","created_at":"2016-11-26T13:32:50Z","updated_at":"2016-12-29T00:51:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55425cb568b7e32e4128a550c90f9255b88c1962","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zotero/translators/pulls/1189/commits","review_comments_url":"https://api.github.com/repos/zotero/translators/pulls/1189/comments","review_comment_url":"https://api.github.com/repos/zotero/translators/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zotero/translators/issues/1189/comments","statuses_url":"https://api.github.com/repos/zotero/translators/statuses/f0488a39d46a5893f3b3bf51c67ad0a414710e2b","head":{"label":"zuphilip:citavi-xml","ref":"citavi-xml","sha":"f0488a39d46a5893f3b3bf51c67ad0a414710e2b","user":{"login":"zuphilip","id":5199995,"avatar_url":"https://avatars.githubusercontent.com/u/5199995?v=3","gravatar_id":"","url":"https://api.github.com/users/zuphilip","html_url":"https://github.com/zuphilip","followers_url":"https://api.github.com/users/zuphilip/followers","following_url":"https://api.github.com/users/zuphilip/following{/other_user}","gists_url":"https://api.github.com/users/zuphilip/gists{/gist_id}","starred_url":"https://api.github.com/users/zuphilip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zuphilip/subscriptions","organizations_url":"https://api.github.com/users/zuphilip/orgs","repos_url":"https://api.github.com/users/zuphilip/repos","events_url":"https://api.github.com/users/zuphilip/events{/privacy}","received_events_url":"https://api.github.com/users/zuphilip/received_events","type":"User","site_admin":false},"repo":{"id":23522231,"name":"translators","full_name":"zuphilip/translators","owner":{"login":"zuphilip","id":5199995,"avatar_url":"https://avatars.githubusercontent.com/u/5199995?v=3","gravatar_id":"","url":"https://api.github.com/users/zuphilip","html_url":"https://github.com/zuphilip","followers_url":"https://api.github.com/users/zuphilip/followers","following_url":"https://api.github.com/users/zuphilip/following{/other_user}","gists_url":"https://api.github.com/users/zuphilip/gists{/gist_id}","starred_url":"https://api.github.com/users/zuphilip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zuphilip/subscriptions","organizations_url":"https://api.github.com/users/zuphilip/orgs","repos_url":"https://api.github.com/users/zuphilip/repos","events_url":"https://api.github.com/users/zuphilip/events{/privacy}","received_events_url":"https://api.github.com/users/zuphilip/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zuphilip/translators","description":"Zotero Translators","fork":true,"url":"https://api.github.com/repos/zuphilip/translators","forks_url":"https://api.github.com/repos/zuphilip/translators/forks","keys_url":"https://api.github.com/repos/zuphilip/translators/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zuphilip/translators/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zuphilip/translators/teams","hooks_url":"https://api.github.com/repos/zuphilip/translators/hooks","issue_events_url":"https://api.github.com/repos/zuphilip/translators/issues/events{/number}","events_url":"https://api.github.com/repos/zuphilip/translators/events","assignees_url":"https://api.github.com/repos/zuphilip/translators/assignees{/user}","branches_url":"https://api.github.com/repos/zuphilip/translators/branches{/branch}","tags_url":"https://api.github.com/repos/zuphilip/translators/tags","blobs_url":"https://api.github.com/repos/zuphilip/translators/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zuphilip/translators/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zuphilip/translators/git/refs{/sha}","trees_url":"https://api.github.com/repos/zuphilip/translators/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zuphilip/translators/statuses/{sha}","languages_url":"https://api.github.com/repos/zuphilip/translators/languages","stargazers_url":"https://api.github.com/repos/zuphilip/translators/stargazers","contributors_url":"https://api.github.com/repos/zuphilip/translators/contributors","subscribers_url":"https://api.github.com/repos/zuphilip/translators/subscribers","subscription_url":"https://api.github.com/repos/zuphilip/translators/subscription","commits_url":"https://api.github.com/repos/zuphilip/translators/commits{/sha}","git_commits_url":"https://api.github.com/repos/zuphilip/translators/git/commits{/sha}","comments_url":"https://api.github.com/repos/zuphilip/translators/comments{/number}","issue_comment_url":"https://api.github.com/repos/zuphilip/translators/issues/comments{/number}","contents_url":"https://api.github.com/repos/zuphilip/translators/contents/{+path}","compare_url":"https://api.github.com/repos/zuphilip/translators/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zuphilip/translators/merges","archive_url":"https://api.github.com/repos/zuphilip/translators/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zuphilip/translators/downloads","issues_url":"https://api.github.com/repos/zuphilip/translators/issues{/number}","pulls_url":"https://api.github.com/repos/zuphilip/translators/pulls{/number}","milestones_url":"https://api.github.com/repos/zuphilip/translators/milestones{/number}","notifications_url":"https://api.github.com/repos/zuphilip/translators/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zuphilip/translators/labels{/name}","releases_url":"https://api.github.com/repos/zuphilip/translators/releases{/id}","deployments_url":"https://api.github.com/repos/zuphilip/translators/deployments","created_at":"2014-08-31T20:18:19Z","updated_at":"2016-12-27T09:28:01Z","pushed_at":"2016-12-28T00:02:10Z","git_url":"git://github.com/zuphilip/translators.git","ssh_url":"git@github.com:zuphilip/translators.git","clone_url":"https://github.com/zuphilip/translators.git","svn_url":"https://github.com/zuphilip/translators","homepage":"http://www.zotero.org/support/dev/translators","size":11985,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"zotero:master","ref":"master","sha":"838477428f21ac49d09229fe3548fc5fc96b0ff6","user":{"login":"zotero","id":891917,"avatar_url":"https://avatars.githubusercontent.com/u/891917?v=3","gravatar_id":"","url":"https://api.github.com/users/zotero","html_url":"https://github.com/zotero","followers_url":"https://api.github.com/users/zotero/followers","following_url":"https://api.github.com/users/zotero/following{/other_user}","gists_url":"https://api.github.com/users/zotero/gists{/gist_id}","starred_url":"https://api.github.com/users/zotero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zotero/subscriptions","organizations_url":"https://api.github.com/users/zotero/orgs","repos_url":"https://api.github.com/users/zotero/repos","events_url":"https://api.github.com/users/zotero/events{/privacy}","received_events_url":"https://api.github.com/users/zotero/received_events","type":"Organization","site_admin":false},"repo":{"id":1991863,"name":"translators","full_name":"zotero/translators","owner":{"login":"zotero","id":891917,"avatar_url":"https://avatars.githubusercontent.com/u/891917?v=3","gravatar_id":"","url":"https://api.github.com/users/zotero","html_url":"https://github.com/zotero","followers_url":"https://api.github.com/users/zotero/followers","following_url":"https://api.github.com/users/zotero/following{/other_user}","gists_url":"https://api.github.com/users/zotero/gists{/gist_id}","starred_url":"https://api.github.com/users/zotero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zotero/subscriptions","organizations_url":"https://api.github.com/users/zotero/orgs","repos_url":"https://api.github.com/users/zotero/repos","events_url":"https://api.github.com/users/zotero/events{/privacy}","received_events_url":"https://api.github.com/users/zotero/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zotero/translators","description":"Zotero Translators","fork":false,"url":"https://api.github.com/repos/zotero/translators","forks_url":"https://api.github.com/repos/zotero/translators/forks","keys_url":"https://api.github.com/repos/zotero/translators/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zotero/translators/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zotero/translators/teams","hooks_url":"https://api.github.com/repos/zotero/translators/hooks","issue_events_url":"https://api.github.com/repos/zotero/translators/issues/events{/number}","events_url":"https://api.github.com/repos/zotero/translators/events","assignees_url":"https://api.github.com/repos/zotero/translators/assignees{/user}","branches_url":"https://api.github.com/repos/zotero/translators/branches{/branch}","tags_url":"https://api.github.com/repos/zotero/translators/tags","blobs_url":"https://api.github.com/repos/zotero/translators/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zotero/translators/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zotero/translators/git/refs{/sha}","trees_url":"https://api.github.com/repos/zotero/translators/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zotero/translators/statuses/{sha}","languages_url":"https://api.github.com/repos/zotero/translators/languages","stargazers_url":"https://api.github.com/repos/zotero/translators/stargazers","contributors_url":"https://api.github.com/repos/zotero/translators/contributors","subscribers_url":"https://api.github.com/repos/zotero/translators/subscribers","subscription_url":"https://api.github.com/repos/zotero/translators/subscription","commits_url":"https://api.github.com/repos/zotero/translators/commits{/sha}","git_commits_url":"https://api.github.com/repos/zotero/translators/git/commits{/sha}","comments_url":"https://api.github.com/repos/zotero/translators/comments{/number}","issue_comment_url":"https://api.github.com/repos/zotero/translators/issues/comments{/number}","contents_url":"https://api.github.com/repos/zotero/translators/contents/{+path}","compare_url":"https://api.github.com/repos/zotero/translators/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zotero/translators/merges","archive_url":"https://api.github.com/repos/zotero/translators/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zotero/translators/downloads","issues_url":"https://api.github.com/repos/zotero/translators/issues{/number}","pulls_url":"https://api.github.com/repos/zotero/translators/pulls{/number}","milestones_url":"https://api.github.com/repos/zotero/translators/milestones{/number}","notifications_url":"https://api.github.com/repos/zotero/translators/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zotero/translators/labels{/name}","releases_url":"https://api.github.com/repos/zotero/translators/releases{/id}","deployments_url":"https://api.github.com/repos/zotero/translators/deployments","created_at":"2011-07-03T17:40:38Z","updated_at":"2016-12-25T07:10:53Z","pushed_at":"2016-12-28T14:40:04Z","git_url":"git://github.com/zotero/translators.git","ssh_url":"git@github.com:zotero/translators.git","clone_url":"https://github.com/zotero/translators.git","svn_url":"https://github.com/zotero/translators","homepage":"http://www.zotero.org/support/dev/translators","size":11783,"stargazers_count":201,"watchers_count":201,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":178,"mirror_url":null,"open_issues_count":179,"forks":178,"open_issues":179,"watchers":201,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zotero/translators/pulls/1189"},"html":{"href":"https://github.com/zotero/translators/pull/1189"},"issue":{"href":"https://api.github.com/repos/zotero/translators/issues/1189"},"comments":{"href":"https://api.github.com/repos/zotero/translators/issues/1189/comments"},"review_comments":{"href":"https://api.github.com/repos/zotero/translators/pulls/1189/comments"},"review_comment":{"href":"https://api.github.com/repos/zotero/translators/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zotero/translators/pulls/1189/commits"},"statuses":{"href":"https://api.github.com/repos/zotero/translators/statuses/f0488a39d46a5893f3b3bf51c67ad0a414710e2b"}}}}
{"actor":{"display_login":"zuphilip"}}