{"action":"created","comment":{"url":"https://api.github.com/repos/getnikola/nikola/pulls/comments/34415356","id":34415356,"diff_hunk":"@@ -148,6 +179,53 @@ def _execute(self, options={}, args=[]):\n \n         self.separate_qtranslate_content = options.get('separate_qtranslate_content')\n         self.translations_pattern = options.get('translations_pattern')\n+        return True\n+\n+    def _prepare(self, channel):\n+        self.context = self.populate_context(channel)\n+        self.base_dir = urlparse(self.context['BASE_URL']).path\n+\n+        if self.export_categories_as_categories:\n+            wordpress_namespace = channel.nsmap['wp']\n+            cat_map = dict()\n+            for cat in channel.findall('{{{0}}}category'.format(wordpress_namespace)):\n+                # cat_id = get_text_tag(cat, '{{{0}}}term_id'.format(wordpress_namespace), None)\n+                cat_slug = get_text_tag(cat, '{{{0}}}category_nicename'.format(wordpress_namespace), None)\n+                cat_parent_slug = get_text_tag(cat, '{{{0}}}category_parent'.format(wordpress_namespace), None)\n+                cat_name = get_text_tag(cat, '{{{0}}}cat_name'.format(wordpress_namespace), None)\n+                cat_path = [cat_name]\n+                if cat_parent_slug in cat_map:\n+                    cat_path = cat_map[cat_parent_slug] + cat_path\n+                cat_map[cat_slug] = cat_path\n+            self._category_paths = dict()\n+            for cat, path in cat_map.items():\n+                self._category_paths[cat] = utils.join_hierarchical_category_path(path)\n+\n+    def _adjust_config_template(self, channel, rendered_template):","path":"nikola/plugins/command/import_wordpress.py","position":null,"original_position":103,"commit_id":"0a9b7be794894a6b34939d838261b2f6761b10a5","original_commit_id":"f2b61cd6c71057e1572613aefdf6f4c71e368741","user":{"login":"felixfontein","id":5781356,"avatar_url":"https://avatars.githubusercontent.com/u/5781356?v=3","gravatar_id":"","url":"https://api.github.com/users/felixfontein","html_url":"https://github.com/felixfontein","followers_url":"https://api.github.com/users/felixfontein/followers","following_url":"https://api.github.com/users/felixfontein/following{/other_user}","gists_url":"https://api.github.com/users/felixfontein/gists{/gist_id}","starred_url":"https://api.github.com/users/felixfontein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixfontein/subscriptions","organizations_url":"https://api.github.com/users/felixfontein/orgs","repos_url":"https://api.github.com/users/felixfontein/repos","events_url":"https://api.github.com/users/felixfontein/events{/privacy}","received_events_url":"https://api.github.com/users/felixfontein/received_events","type":"User","site_admin":false},"body":"Yes, I took the old code and modified it. I've removed it now and did it the way you wanted. (Actually I prefer it that way, too :) )","created_at":"2015-07-11T18:52:00Z","updated_at":"2015-07-11T18:52:00Z","html_url":"https://github.com/getnikola/nikola/pull/1867#discussion_r34415356","pull_request_url":"https://api.github.com/repos/getnikola/nikola/pulls/1867","_links":{"self":{"href":"https://api.github.com/repos/getnikola/nikola/pulls/comments/34415356"},"html":{"href":"https://github.com/getnikola/nikola/pull/1867#discussion_r34415356"},"pull_request":{"href":"https://api.github.com/repos/getnikola/nikola/pulls/1867"}}},"pull_request":{"url":"https://api.github.com/repos/getnikola/nikola/pulls/1867","id":39306393,"html_url":"https://github.com/getnikola/nikola/pull/1867","diff_url":"https://github.com/getnikola/nikola/pull/1867.diff","patch_url":"https://github.com/getnikola/nikola/pull/1867.patch","issue_url":"https://api.github.com/repos/getnikola/nikola/issues/1867","number":1867,"state":"open","locked":false,"title":"Extending and refactoring WordPress importer","user":{"login":"felixfontein","id":5781356,"avatar_url":"https://avatars.githubusercontent.com/u/5781356?v=3","gravatar_id":"","url":"https://api.github.com/users/felixfontein","html_url":"https://github.com/felixfontein","followers_url":"https://api.github.com/users/felixfontein/followers","following_url":"https://api.github.com/users/felixfontein/following{/other_user}","gists_url":"https://api.github.com/users/felixfontein/gists{/gist_id}","starred_url":"https://api.github.com/users/felixfontein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixfontein/subscriptions","organizations_url":"https://api.github.com/users/felixfontein/orgs","repos_url":"https://api.github.com/users/felixfontein/repos","events_url":"https://api.github.com/users/felixfontein/events{/privacy}","received_events_url":"https://api.github.com/users/felixfontein/received_events","type":"User","site_admin":false},"body":"Beginning with some refactoring and extending of the WordPress importer.\r\nDone so far:\r\n * Feeding all posts together with post format through transform_content, and let it decide extension.\r\n * No longer using extension `.wp` for WordPress-to-markdown converted posts.\r\n * Exporting wp-status and excerpt (if available).\r\n * Allowing to exclude private items and include empty items.\r\n * Exporting attachment-post/page relation as JSON file.\r\n * Exporting categories (if there's only one per post) including category hierarchy.\r\n * Exporting comments.\r\n\r\nThings to do:\r\n * Add support for WordPress page compiler plugin (both to make new site use it, or to use it to convert WordPress posts to `.html` files).\r\n\r\n(I.e. moving most code from https://github.com/felixfontein/nikola-wordpress/blob/import-wordpress-refactoring/plugins/command/import_wordpress2.py to here.)\r\n\r\n<!-- Reviewable:start -->\r\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/getnikola/nikola/1867)\r\n<!-- Reviewable:end -->\r\n","created_at":"2015-07-06T20:19:14Z","updated_at":"2015-07-11T18:52:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1024199ae81302cc904a1918c3a4e6981c9c95e0","assignee":{"login":"felixfontein","id":5781356,"avatar_url":"https://avatars.githubusercontent.com/u/5781356?v=3","gravatar_id":"","url":"https://api.github.com/users/felixfontein","html_url":"https://github.com/felixfontein","followers_url":"https://api.github.com/users/felixfontein/followers","following_url":"https://api.github.com/users/felixfontein/following{/other_user}","gists_url":"https://api.github.com/users/felixfontein/gists{/gist_id}","starred_url":"https://api.github.com/users/felixfontein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixfontein/subscriptions","organizations_url":"https://api.github.com/users/felixfontein/orgs","repos_url":"https://api.github.com/users/felixfontein/repos","events_url":"https://api.github.com/users/felixfontein/events{/privacy}","received_events_url":"https://api.github.com/users/felixfontein/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/getnikola/nikola/pulls/1867/commits","review_comments_url":"https://api.github.com/repos/getnikola/nikola/pulls/1867/comments","review_comment_url":"https://api.github.com/repos/getnikola/nikola/pulls/comments{/number}","comments_url":"https://api.github.com/repos/getnikola/nikola/issues/1867/comments","statuses_url":"https://api.github.com/repos/getnikola/nikola/statuses/0a9b7be794894a6b34939d838261b2f6761b10a5","head":{"label":"getnikola:import-wordpress-refactoring","ref":"import-wordpress-refactoring","sha":"0a9b7be794894a6b34939d838261b2f6761b10a5","user":{"login":"getnikola","id":5413476,"avatar_url":"https://avatars.githubusercontent.com/u/5413476?v=3","gravatar_id":"","url":"https://api.github.com/users/getnikola","html_url":"https://github.com/getnikola","followers_url":"https://api.github.com/users/getnikola/followers","following_url":"https://api.github.com/users/getnikola/following{/other_user}","gists_url":"https://api.github.com/users/getnikola/gists{/gist_id}","starred_url":"https://api.github.com/users/getnikola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getnikola/subscriptions","organizations_url":"https://api.github.com/users/getnikola/orgs","repos_url":"https://api.github.com/users/getnikola/repos","events_url":"https://api.github.com/users/getnikola/events{/privacy}","received_events_url":"https://api.github.com/users/getnikola/received_events","type":"Organization","site_admin":false},"repo":{"id":4025121,"name":"nikola","full_name":"getnikola/nikola","owner":{"login":"getnikola","id":5413476,"avatar_url":"https://avatars.githubusercontent.com/u/5413476?v=3","gravatar_id":"","url":"https://api.github.com/users/getnikola","html_url":"https://github.com/getnikola","followers_url":"https://api.github.com/users/getnikola/followers","following_url":"https://api.github.com/users/getnikola/following{/other_user}","gists_url":"https://api.github.com/users/getnikola/gists{/gist_id}","starred_url":"https://api.github.com/users/getnikola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getnikola/subscriptions","organizations_url":"https://api.github.com/users/getnikola/orgs","repos_url":"https://api.github.com/users/getnikola/repos","events_url":"https://api.github.com/users/getnikola/events{/privacy}","received_events_url":"https://api.github.com/users/getnikola/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getnikola/nikola","description":"A static website and blog generator","fork":false,"url":"https://api.github.com/repos/getnikola/nikola","forks_url":"https://api.github.com/repos/getnikola/nikola/forks","keys_url":"https://api.github.com/repos/getnikola/nikola/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getnikola/nikola/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getnikola/nikola/teams","hooks_url":"https://api.github.com/repos/getnikola/nikola/hooks","issue_events_url":"https://api.github.com/repos/getnikola/nikola/issues/events{/number}","events_url":"https://api.github.com/repos/getnikola/nikola/events","assignees_url":"https://api.github.com/repos/getnikola/nikola/assignees{/user}","branches_url":"https://api.github.com/repos/getnikola/nikola/branches{/branch}","tags_url":"https://api.github.com/repos/getnikola/nikola/tags","blobs_url":"https://api.github.com/repos/getnikola/nikola/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getnikola/nikola/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getnikola/nikola/git/refs{/sha}","trees_url":"https://api.github.com/repos/getnikola/nikola/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getnikola/nikola/statuses/{sha}","languages_url":"https://api.github.com/repos/getnikola/nikola/languages","stargazers_url":"https://api.github.com/repos/getnikola/nikola/stargazers","contributors_url":"https://api.github.com/repos/getnikola/nikola/contributors","subscribers_url":"https://api.github.com/repos/getnikola/nikola/subscribers","subscription_url":"https://api.github.com/repos/getnikola/nikola/subscription","commits_url":"https://api.github.com/repos/getnikola/nikola/commits{/sha}","git_commits_url":"https://api.github.com/repos/getnikola/nikola/git/commits{/sha}","comments_url":"https://api.github.com/repos/getnikola/nikola/comments{/number}","issue_comment_url":"https://api.github.com/repos/getnikola/nikola/issues/comments{/number}","contents_url":"https://api.github.com/repos/getnikola/nikola/contents/{+path}","compare_url":"https://api.github.com/repos/getnikola/nikola/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getnikola/nikola/merges","archive_url":"https://api.github.com/repos/getnikola/nikola/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getnikola/nikola/downloads","issues_url":"https://api.github.com/repos/getnikola/nikola/issues{/number}","pulls_url":"https://api.github.com/repos/getnikola/nikola/pulls{/number}","milestones_url":"https://api.github.com/repos/getnikola/nikola/milestones{/number}","notifications_url":"https://api.github.com/repos/getnikola/nikola/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getnikola/nikola/labels{/name}","releases_url":"https://api.github.com/repos/getnikola/nikola/releases{/id}","created_at":"2012-04-14T13:53:22Z","updated_at":"2015-07-11T09:17:34Z","pushed_at":"2015-07-11T18:51:26Z","git_url":"git://github.com/getnikola/nikola.git","ssh_url":"git@github.com:getnikola/nikola.git","clone_url":"https://github.com/getnikola/nikola.git","svn_url":"https://github.com/getnikola/nikola","homepage":"https://getnikola.com/","size":31545,"stargazers_count":794,"watchers_count":794,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":228,"mirror_url":null,"open_issues_count":56,"forks":228,"open_issues":56,"watchers":794,"default_branch":"master"}},"base":{"label":"getnikola:master","ref":"master","sha":"c8f7a6ae1ad4895ff56bf8a8a8787e720eff3787","user":{"login":"getnikola","id":5413476,"avatar_url":"https://avatars.githubusercontent.com/u/5413476?v=3","gravatar_id":"","url":"https://api.github.com/users/getnikola","html_url":"https://github.com/getnikola","followers_url":"https://api.github.com/users/getnikola/followers","following_url":"https://api.github.com/users/getnikola/following{/other_user}","gists_url":"https://api.github.com/users/getnikola/gists{/gist_id}","starred_url":"https://api.github.com/users/getnikola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getnikola/subscriptions","organizations_url":"https://api.github.com/users/getnikola/orgs","repos_url":"https://api.github.com/users/getnikola/repos","events_url":"https://api.github.com/users/getnikola/events{/privacy}","received_events_url":"https://api.github.com/users/getnikola/received_events","type":"Organization","site_admin":false},"repo":{"id":4025121,"name":"nikola","full_name":"getnikola/nikola","owner":{"login":"getnikola","id":5413476,"avatar_url":"https://avatars.githubusercontent.com/u/5413476?v=3","gravatar_id":"","url":"https://api.github.com/users/getnikola","html_url":"https://github.com/getnikola","followers_url":"https://api.github.com/users/getnikola/followers","following_url":"https://api.github.com/users/getnikola/following{/other_user}","gists_url":"https://api.github.com/users/getnikola/gists{/gist_id}","starred_url":"https://api.github.com/users/getnikola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getnikola/subscriptions","organizations_url":"https://api.github.com/users/getnikola/orgs","repos_url":"https://api.github.com/users/getnikola/repos","events_url":"https://api.github.com/users/getnikola/events{/privacy}","received_events_url":"https://api.github.com/users/getnikola/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getnikola/nikola","description":"A static website and blog generator","fork":false,"url":"https://api.github.com/repos/getnikola/nikola","forks_url":"https://api.github.com/repos/getnikola/nikola/forks","keys_url":"https://api.github.com/repos/getnikola/nikola/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getnikola/nikola/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getnikola/nikola/teams","hooks_url":"https://api.github.com/repos/getnikola/nikola/hooks","issue_events_url":"https://api.github.com/repos/getnikola/nikola/issues/events{/number}","events_url":"https://api.github.com/repos/getnikola/nikola/events","assignees_url":"https://api.github.com/repos/getnikola/nikola/assignees{/user}","branches_url":"https://api.github.com/repos/getnikola/nikola/branches{/branch}","tags_url":"https://api.github.com/repos/getnikola/nikola/tags","blobs_url":"https://api.github.com/repos/getnikola/nikola/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getnikola/nikola/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getnikola/nikola/git/refs{/sha}","trees_url":"https://api.github.com/repos/getnikola/nikola/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getnikola/nikola/statuses/{sha}","languages_url":"https://api.github.com/repos/getnikola/nikola/languages","stargazers_url":"https://api.github.com/repos/getnikola/nikola/stargazers","contributors_url":"https://api.github.com/repos/getnikola/nikola/contributors","subscribers_url":"https://api.github.com/repos/getnikola/nikola/subscribers","subscription_url":"https://api.github.com/repos/getnikola/nikola/subscription","commits_url":"https://api.github.com/repos/getnikola/nikola/commits{/sha}","git_commits_url":"https://api.github.com/repos/getnikola/nikola/git/commits{/sha}","comments_url":"https://api.github.com/repos/getnikola/nikola/comments{/number}","issue_comment_url":"https://api.github.com/repos/getnikola/nikola/issues/comments{/number}","contents_url":"https://api.github.com/repos/getnikola/nikola/contents/{+path}","compare_url":"https://api.github.com/repos/getnikola/nikola/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getnikola/nikola/merges","archive_url":"https://api.github.com/repos/getnikola/nikola/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getnikola/nikola/downloads","issues_url":"https://api.github.com/repos/getnikola/nikola/issues{/number}","pulls_url":"https://api.github.com/repos/getnikola/nikola/pulls{/number}","milestones_url":"https://api.github.com/repos/getnikola/nikola/milestones{/number}","notifications_url":"https://api.github.com/repos/getnikola/nikola/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getnikola/nikola/labels{/name}","releases_url":"https://api.github.com/repos/getnikola/nikola/releases{/id}","created_at":"2012-04-14T13:53:22Z","updated_at":"2015-07-11T09:17:34Z","pushed_at":"2015-07-11T18:51:26Z","git_url":"git://github.com/getnikola/nikola.git","ssh_url":"git@github.com:getnikola/nikola.git","clone_url":"https://github.com/getnikola/nikola.git","svn_url":"https://github.com/getnikola/nikola","homepage":"https://getnikola.com/","size":31545,"stargazers_count":794,"watchers_count":794,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":228,"mirror_url":null,"open_issues_count":56,"forks":228,"open_issues":56,"watchers":794,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/getnikola/nikola/pulls/1867"},"html":{"href":"https://github.com/getnikola/nikola/pull/1867"},"issue":{"href":"https://api.github.com/repos/getnikola/nikola/issues/1867"},"comments":{"href":"https://api.github.com/repos/getnikola/nikola/issues/1867/comments"},"review_comments":{"href":"https://api.github.com/repos/getnikola/nikola/pulls/1867/comments"},"review_comment":{"href":"https://api.github.com/repos/getnikola/nikola/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/getnikola/nikola/pulls/1867/commits"},"statuses":{"href":"https://api.github.com/repos/getnikola/nikola/statuses/0a9b7be794894a6b34939d838261b2f6761b10a5"}}}}