Skip to content

Commit

Permalink
Update wordpressdotcom importer to clean up after #134.
Browse files Browse the repository at this point in the history
  • Loading branch information
parkr committed May 23, 2014
1 parent 9ffa107 commit 2585ed9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 2 additions & 5 deletions lib/jekyll-import/importers/wordpressdotcom.rb
Expand Up @@ -55,7 +55,7 @@ def self.download_images(title, post_hpricot, assets_folder)

def self.process(options)
source = options.fetch('source', "wordpress.xml")
no_fetch = options.fetch('no_fetch_images', false)
fetch = !options.fetch('no_fetch_images', false)
assets_folder = options.fetch('assets_folder', 'assets')
FileUtils.mkdir_p(assets_folder)

Expand Down Expand Up @@ -120,13 +120,10 @@ def self.process(options)
begin
content = Hpricot(item.at('content:encoded').inner_text)

if !no_fetch
if fetch
download_images(title, content, assets_folder)
end

(content/"pre").each do |pre|
pre["class"] = 'prettyprint'
end
FileUtils.mkdir_p "_#{type}s"
File.open("_#{type}s/#{name}", "w") do |f|
f.puts header.to_yaml
Expand Down
7 changes: 5 additions & 2 deletions site/docs/wordpressdotcom.md
Expand Up @@ -12,11 +12,14 @@ To import your posts from a [WordPress.com](http://wordpress.com) blog, run:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll-import";
JekyllImport::Importers::WordpressDotCom.run({
"source" => "wordpress.xml"
"source" => "wordpress.xml",
"no_fetch_images" => false,
"assets_folder" => "assets"
})'
{% endhighlight %}

The `source` field is not required. Its default is what you see above.
The `source`, `no_fetch_images`, and `assets_folder` fields are not required.
Their default values are what you see above.

<div class="note">
<h5>ProTip™: WordPress.com Export Tool</h5>
Expand Down

0 comments on commit 2585ed9

Please sign in to comment.