Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Imported excerpt from Wordpress and write out the "description" header.

  • Loading branch information...
commit 0169d444efbfbf7a3e9dc0d189eadd50bf4a5af3 1 parent d79479f
@geekman geekman authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 acrylamid/tasks/imprt.py
View
4 acrylamid/tasks/imprt.py
@@ -245,6 +245,7 @@ def generate(item):
'link': item.find('link').text,
'content': (item.find('%sencoded' % cons).text or '').replace('\n', '<br />\n'),
+ 'description': item.find('%sencoded' % excerptns).text or '',
'date': datetime.strptime(item.find('%spost_date' % wpns).text,
"%Y-%m-%d %H:%M:%S"),
@@ -279,6 +280,7 @@ def generate(item):
for version in range(1, 10):
wpns = '{http://wordpress.org/export/1.%i/}' % version
+ excerptns = '{http://wordpress.org/export/1.%i/excerpt/}' % version
if tree.find('channel/%swxr_version' % wpns) is None:
continue
entries = list(map(generate, tree.findall('channel/item')))
@@ -347,6 +349,8 @@ def create(defaults, item):
f.write(u'draft: %s\n' % item['draft'])
if 'tags' in item:
f.write(u'tags: [%s]\n' % ', '.join(item['tags']))
+ if item.get('description'):
+ f.write(u'description: %s\n' % item['description'])
if 'permalink' in item:
f.write(u'permalink: %s\n' % item['permalink'])
if item.get('type', 'entry') != 'entry':
Please sign in to comment.
Something went wrong with that request. Please try again.