Skip to content
Permalink
Browse files
fix #484
  • Loading branch information
ralsina committed Jun 12, 2015
1 parent cf33d84 commit bfb2d77ce766b0415096a40162017556b8c4fe57
Showing 2 changed files with 10 additions and 2 deletions.
@@ -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)
@@ -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

@@ -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'] +
@@ -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)

0 comments on commit bfb2d77

Please sign in to comment.