diff --git a/plugins/pelican_comments/wp2comments b/plugins/pelican_comments/wp2comments index 9e4beab..365cfff 100644 --- a/plugins/pelican_comments/wp2comments +++ b/plugins/pelican_comments/wp2comments @@ -5,11 +5,12 @@ import sys import os from lxml import etree -COMMENT_DIR='comments' +COMMENT_DIR = 'comments' + def wp2comments(xml): - #xmlfile = open(xml, encoding='utf-8', mode='r').read() + # xmlfile = open(xml, encoding='utf-8', mode='r').read() tree = etree.parse(xml) root = tree.getroot() items = root.findall('.//item') @@ -24,7 +25,8 @@ def wp2comments(xml): for item in items: title = item.find('title') - if title is None: continue + if title is None: + continue # Only fetch comments from published posts. status = item.find('wp:status', namespaces=root.nsmap) @@ -69,9 +71,10 @@ def wp2comments(xml): f.write(u'Date: %s\n' % (date, )) f.write(u'Author_Email: %s\n' % (email, )) f.write(u'Author_IP: %s\n' % (ip, )) + f.write(u'Web: %s\n' % (url, )) f.write(u'\n%s\n' % (content, )) f.close() if __name__ == '__main__': - wp2comments(sys.argv[1]) + wp2comments(sys.argv[1])