1
0
Fork 0
forked from github/pelican

Fix importing Tumblr photo caption

Besides each photo's caption, the general caption is also needed.

While we're at it, also add a linefeed at the end of file.
This commit is contained in:
Lingzhu Xiang 2013-05-05 02:09:24 +08:00 committed by Lingzhu Xiang
commit 75263fa852

View file

@ -370,6 +370,7 @@ def tumblr2fields(api_key, blogname):
else:
fmtstr = '<img alt="%s" src="%s" />'
content = '\n'.join(fmtstr % (photo.get('caption'), photo.get('original_size').get('url')) for photo in post.get('photos'))
content += '\n\n' + post.get('caption')
elif type == 'quote':
if format == 'markdown':
fmtstr = '\n\n&mdash; %s'
@ -398,6 +399,8 @@ def tumblr2fields(api_key, blogname):
title = post.get('question')
content = '<p><a href="%s" rel="external nofollow">%s</a>: %s</p>\n%s' % (post.get('asking_name'), post.get('asking_url'), post.get('question'), post.get('answer'))
content = content.rstrip() + '\n'
yield (title, content, slug, date, post.get('blog_name'), [type], tags, format)
offset += len(posts)