Skip to content

Correctly handle wordpressdotcom drafts#213

Merged
parkr merged 3 commits intojekyll:masterfrom
danbernier:correctly-handle-wordpressdotcom-drafts
Aug 16, 2015
Merged

Correctly handle wordpressdotcom drafts#213
parkr merged 3 commits intojekyll:masterfrom
danbernier:correctly-handle-wordpressdotcom-drafts

Conversation

@danbernier
Copy link
Contributor

When importing an unpublished draft from wordpress.com, jekyll-import was raising an exception trying to parse its published date, which is set to 0000-00-00 00:00:00. It was using this to prepend the publish-date to the filename in ./_posts.

This pull request changes the WordpressDotCom import so that:

  • it doesn't try to parse the zero dates
  • it doesn't prepend the date to the filenames
  • it stores drafts in ./_drafts instead of ./_posts

I also added a bunch of test coverage for the WordpressDotCom importer, mostly by pulling lots of logic into a separate class, JekyllImport::Importers::WordpressDotCom::Item, and constructing those with specific XML. The actual writing of files is still untested, but there's less going on there now.

We'll add an 'item' local variable back soon.
* Store them in ./_drafts, not ./_posts
* Don't prepend the date to the filename
@parkr
Copy link
Member

parkr commented Aug 16, 2015

One of the best PR's ever! Some room for optimizations but looks solid to me! Thanks :)

@parkr parkr merged commit a043572 into jekyll:master Aug 16, 2015
parkr added a commit that referenced this pull request Aug 16, 2015
parkr added a commit that referenced this pull request Aug 16, 2015
* danbernier-correctly-handle-wordpressdotcom-drafts:
  Clean up WordpressDotCom::Item usage a bit. /cc #213
  Correctly handle draft posts.
  Wrap WP's item nodes in an Item, that can extract its data.
  Rename block var from `item` to `node`.
parkr added a commit that referenced this pull request Aug 16, 2015
@danbernier
Copy link
Contributor Author

You're welcome! It's a common refactoring I use :) Glad you memoized the methods, I'm surprised I forgot to do that.

@danbernier danbernier deleted the correctly-handle-wordpressdotcom-drafts branch August 17, 2015 01:20
@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants