1
0
Fork 0
forked from github/pelican

Merge pull request #841 from Rogdham/pelican-import_wp_no-title

Warn user in case of missing title. Fixes #440.
This commit is contained in:
Justin Mayer 2013-04-13 14:10:00 -07:00
commit 5554668d37

View file

@ -14,10 +14,14 @@ import re
import subprocess
import sys
import time
import logging
from codecs import open
from pelican.utils import slugify
from pelican.log import init
logger = logging.getLogger(__name__)
def decode_wp_content(content, br=True):
@ -114,7 +118,8 @@ def wp2fields(xml):
# Use HTMLParser due to issues with BeautifulSoup 3
title = HTMLParser().unescape(item.title.contents[0])
except IndexError:
continue
title = 'No title [%s]' % item.find('post_name').string
logger.warn('Post "%s" is lacking a proper title' % title)
content = item.find('encoded').string
filename = item.find('post_name').string
@ -492,6 +497,8 @@ def main():
elif input_type == 'feed':
fields = feed2fields(args.input)
init() # init logging
fields2pelican(fields, args.markup, args.output,
dircat=args.dircat or False,
strip_raw=args.strip_raw or False,