Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix #484
  • Loading branch information
ralsina committed Jun 12, 2015
1 parent cf33d84 commit bfb2d77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -12,6 +12,7 @@ Features
Bugfixes
--------

* Support pure markdown posts in WP import (Issue #484)
* Make auto shutdown with ctrl-c (Issue #1811)
* Log properly in ``nikola auto`` (Issue #1812)
* Handle rare gettz failure (Issue #1806)
Expand Down
11 changes: 9 additions & 2 deletions nikola/plugins/command/import_wordpress.py
Expand Up @@ -283,7 +283,6 @@ def download_additional_image_sizes(self, item, wordpress_namespace, source_path
return

additional_metadata = item.findall('{{{0}}}postmeta'.format(wordpress_namespace))

if additional_metadata is None:
return

Expand Down Expand Up @@ -446,8 +445,15 @@ def import_item(self, item, wordpress_namespace, out_folder=None):
if '$latex' in content:
tags.append('mathjax')

# Find post format if it's there
post_format = 'wp'
format_tag = [x for x in item.findall('*//{%s}meta_key' % wordpress_namespace) if x.text == '_tc_post_format']
if format_tag:
post_format = format_tag[0].getparent().find('{%s}meta_value' % wordpress_namespace).text

if is_draft and self.exclude_drafts:
LOGGER.notice('Draft "{0}" will not be imported.'.format(title))

elif content.strip():
# If no content is found, no files are written.
self.url_map[link] = (self.context['SITE_URL'] +
Expand All @@ -474,7 +480,8 @@ def import_item(self, item, wordpress_namespace, out_folder=None):
out_meta_filename = slug + '.meta'
out_content_filename = slug + '.wp'
meta_slug = slug
content = self.transform_content(content)
if post_format == 'wp':
content = self.transform_content(content)
self.write_metadata(os.path.join(self.output_folder, out_folder,
out_meta_filename),
title, meta_slug, post_date, description, tags)
Expand Down

0 comments on commit bfb2d77

Please sign in to comment.