getpelican/pelican — pull request #1234 by alistairmagee (2014-01-16 00:48:02+00:00)
Title: Wp custom posts and attachment download

Hi,

I wrote two extensions for the pelican-import command line tool.

The first adds support for wordpress custom post types. Adding the --wp-custpost option outputs custom posts into their own directory. If used with the dircat option, posts will be placed as /output/custompostname/category/posts

The second option is --wp-attach. This downloads all files in the Wordpress XML file where the post-type is an attachment. Attachments usually have a parent. The parent posts will have a list of attachments generated and added to their header. The header list will be the paths to the files, relative to the output folder. All attachments will be downloaded even if they don't have a parent. This option is useful if you are changing servers or want to start fresh.

Sorry both features are in the same pull request. I realised later that they should've been separate features, but I'd been working on both before I realised this. Also there is a bit of unnecessary refactoring. I was cleaning the code up because I was using different parts of the fields2pelican code originally but I changed my strategy after a while. All code has been tested on python27 and python33 and all tests pass so nothing is broken, hopefully you think the result is more readable :)