New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly handle wordpressdotcom drafts #213

Merged
merged 3 commits into from Aug 16, 2015

Conversation

Projects
None yet
3 participants
@danbernier
Contributor

danbernier commented Aug 10, 2015

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.

danbernier added some commits Aug 10, 2015

Rename block var from `item` to `node`.
We'll add an 'item' local variable back soon.
Correctly handle draft posts.
* Store them in ./_drafts, not ./_posts
* Don't prepend the date to the filename
@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Aug 16, 2015

Member

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

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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

parkr added a commit that referenced this pull request Aug 16, 2015

parkr added a commit that referenced this pull request Aug 16, 2015

Merge branch 'danbernier-correctly-handle-wordpressdotcom-drafts'
* 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

This comment has been minimized.

Show comment
Hide comment
@danbernier

danbernier Aug 17, 2015

Contributor

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

Contributor

danbernier commented Aug 17, 2015

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 danbernier:correctly-handle-wordpressdotcom-drafts branch Aug 17, 2015

@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.