jekyll-import 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -2
- data/History.markdown +14 -0
- data/README.markdown +24 -10
- data/jekyll-import.gemspec +2 -1
- data/lib/jekyll-import/importers/csv.rb +15 -7
- data/lib/jekyll-import/importers/google_reader.rb +1 -5
- data/lib/jekyll-import/importers/wordpress.rb +54 -11
- data/lib/jekyll-import/importers/wordpressdotcom.rb +44 -3
- data/lib/jekyll-import/util.rb +2 -2
- data/lib/jekyll-import/version.rb +1 -1
- data/site/_config.yml +1 -1
- data/site/_posts/2014-05-23-jekyll-import-0-3-0-released.markdown +22 -0
- data/site/docs/csv.md +12 -0
- data/site/docs/history.md +28 -1
- data/site/docs/wordpress.md +1 -0
- data/site/docs/wordpressdotcom.md +5 -2
- data/test/helper.rb +5 -6
- metadata +19 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0b5d74f3eddb29a55ff845369991337d004ab36f
         | 
| 4 | 
            +
              data.tar.gz: a06bcfad396653de2fd03b1146c3719ea83d73d1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e7eb1b3daf5ffd72d1127dee1298c998402987bd8eb254f293cd773b3bd5f12e2db11f12a3b97bc82cb33f54b6bdeb1842b14aac1b49b77cb91fba754e9a2567
         | 
| 7 | 
            +
              data.tar.gz: b29b9ecafc01d25924932b73d5a48d272013e2523b7da7b94c4e298cc14321e108917a99f6918acedf4f89250fbffada82aa91e55af09d2769db940859533ae3
         | 
    
        data/.travis.yml
    CHANGED
    
    | @@ -1,10 +1,13 @@ | |
| 1 1 | 
             
            language: ruby
         | 
| 2 2 | 
             
            before_install:
         | 
| 3 3 | 
             
              - gem install bundler
         | 
| 4 | 
            +
            install:
         | 
| 5 | 
            +
              - export NOKOGIRI_USE_SYSTEM_LIBRARIES=true
         | 
| 6 | 
            +
              - travis_retry bundle install
         | 
| 4 7 | 
             
            rvm:
         | 
| 5 | 
            -
              - 2. | 
| 8 | 
            +
              - 2.1
         | 
| 9 | 
            +
              - 2.0
         | 
| 6 10 | 
             
              - 1.9.3
         | 
| 7 | 
            -
              - 1.9.2
         | 
| 8 11 | 
             
            script: bundle exec rake
         | 
| 9 12 | 
             
            notifications:
         | 
| 10 13 | 
             
              irc: "irc.freenode.org#jekyll"
         | 
    
        data/History.markdown
    CHANGED
    
    | @@ -10,6 +10,20 @@ | |
| 10 10 |  | 
| 11 11 | 
             
            ### Development Fixes
         | 
| 12 12 |  | 
| 13 | 
            +
            ## 0.3.0 / 2014-05-23
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            ### Minor Enhancements
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              * Import WordPress.org `author` data as hash (#139)
         | 
| 18 | 
            +
              * Add `socket` option to the WordPress importer (#140)
         | 
| 19 | 
            +
              * Allow the CSV importer to skip writing front matter (#143)
         | 
| 20 | 
            +
              * WordPress.com: Download images locally and update links to them (#134)
         | 
| 21 | 
            +
              * WordPress: Import WP pages as proper Jekyll pages instead of as posts (#137)
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            ### Bug Fixes
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              * Replace errant `continue` expression with the valid `next` expression (#133)
         | 
| 26 | 
            +
             | 
| 13 27 | 
             
            ## 0.2.0 / 2014-03-16
         | 
| 14 28 |  | 
| 15 29 | 
             
            ### Major Enhancements
         | 
    
        data/README.markdown
    CHANGED
    
    | @@ -1,18 +1,32 @@ | |
| 1 | 
            -
            jekyll-import
         | 
| 2 | 
            -
             | 
| 1 | 
            +
            # jekyll-import
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            [](https://travis-ci.org/jekyll/jekyll-import)
         | 
| 3 4 |  | 
| 4 5 | 
             
            The new __Jekyll__ command for importing from various blogs to Jekyll format.
         | 
| 5 6 |  | 
| 6 7 | 
             
            **Note: _migrators_ are now called _importers_ and are only available if one installs the `jekyll-import` _gem_.**
         | 
| 7 8 |  | 
| 8 | 
            -
            How `jekyll-import` works:
         | 
| 9 | 
            -
             | 
| 9 | 
            +
            ## How `jekyll-import` works:
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            ### Jekyll v2.x
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            1. Install the _rubygem_ with `gem install jekyll-import`.
         | 
| 14 | 
            +
            2. Run `jekyll import IMPORTER [options]`
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            ### Jekyll v1.x
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            Launch IRB:
         | 
| 10 19 |  | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 20 | 
            +
            ```ruby
         | 
| 21 | 
            +
            # 1. Require jekyll-import
         | 
| 22 | 
            +
            irb> require 'jekyll-import'
         | 
| 23 | 
            +
            # 2. Choose the importer you'd like to use.
         | 
| 24 | 
            +
            irb> importer_class = "Behance" # an example, there are many others!
         | 
| 25 | 
            +
            # 3. Run it!
         | 
| 26 | 
            +
            irb> JekyllImport::Importers.const_get(importer_class).run(options_hash)
         | 
| 27 | 
            +
            ```
         | 
| 14 28 |  | 
| 15 | 
            -
             | 
| 29 | 
            +
            ## Documentation
         | 
| 16 30 |  | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 31 | 
            +
            jekyll-import has its own documentation site, found at http://import.jekyllrb.com.
         | 
| 32 | 
            +
            Dedicated [documentation for each migrator](http://import.jekyllrb.com/docs/home/) is available there.
         | 
    
        data/jekyll-import.gemspec
    CHANGED
    
    | @@ -40,7 +40,7 @@ Gem::Specification.new do |s| | |
| 40 40 |  | 
| 41 41 | 
             
              # test dependencies:
         | 
| 42 42 | 
             
              s.add_development_dependency('redgreen', "~> 1.2")
         | 
| 43 | 
            -
              s.add_development_dependency('shoulda', "~> 3. | 
| 43 | 
            +
              s.add_development_dependency('shoulda', "~> 3.5")
         | 
| 44 44 | 
             
              s.add_development_dependency('rr', "~> 1.0")
         | 
| 45 45 | 
             
              s.add_development_dependency('simplecov', "~> 0.7")
         | 
| 46 46 | 
             
              s.add_development_dependency('simplecov-gem-adapter', "~> 1.0.1")
         | 
| @@ -53,6 +53,7 @@ Gem::Specification.new do |s| | |
| 53 53 | 
             
              s.add_development_dependency('pg', "~> 0.12")
         | 
| 54 54 | 
             
              s.add_development_dependency('mysql2', "~> 0.3")
         | 
| 55 55 | 
             
              s.add_development_dependency('behance', "~> 0.3")
         | 
| 56 | 
            +
              s.add_development_dependency('unidecode')
         | 
| 56 57 |  | 
| 57 58 | 
             
              # site dependencies:
         | 
| 58 59 | 
             
              s.add_development_dependency('launchy', '~> 2.4')
         | 
| @@ -10,6 +10,7 @@ module JekyllImport | |
| 10 10 |  | 
| 11 11 | 
             
                  def self.specify_options(c)
         | 
| 12 12 | 
             
                    c.option 'file', '--file NAME', 'The CSV file to import (default: "posts.csv")'
         | 
| 13 | 
            +
                    c.option 'no-front-matter', '--no-front-matter', 'Do not add the default front matter to the post body'
         | 
| 13 14 | 
             
                  end
         | 
| 14 15 |  | 
| 15 16 | 
             
                  # Reads a csv with title, permalink, body, published_at, and filter.
         | 
| @@ -25,26 +26,33 @@ module JekyllImport | |
| 25 26 | 
             
                      next if row[0] == "title"
         | 
| 26 27 | 
             
                      posts += 1
         | 
| 27 28 | 
             
                      name = build_name(row)
         | 
| 28 | 
            -
                      write_post(name, row[0], row[2])
         | 
| 29 | 
            +
                      write_post(name, row[0], row[2], options)
         | 
| 29 30 | 
             
                    end
         | 
| 30 31 | 
             
                    "Created #{posts} posts!"
         | 
| 31 32 | 
             
                  end
         | 
| 32 33 |  | 
| 33 | 
            -
                  def self.write_post(name, title, content)
         | 
| 34 | 
            +
                  def self.write_post(name, title, content, options)
         | 
| 34 35 | 
             
                    File.open("_posts/#{name}", "w") do |f|
         | 
| 36 | 
            +
                      write_frontmatter(f, title, options)
         | 
| 37 | 
            +
                      f.puts content
         | 
| 38 | 
            +
                    end
         | 
| 39 | 
            +
                  end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                  def self.build_name(row)
         | 
| 42 | 
            +
                    row[3].split(" ")[0]+"-"+row[1]+(row[4] =~ /markdown/ ? ".markdown" : ".textile")
         | 
| 43 | 
            +
                  end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                  def self.write_frontmatter(f, title, options)
         | 
| 46 | 
            +
                    no_frontmatter = options.fetch('no-front-matter', false)
         | 
| 47 | 
            +
                    unless no_frontmatter
         | 
| 35 48 | 
             
                      f.puts <<-HEADER
         | 
| 36 49 | 
             
            ---
         | 
| 37 50 | 
             
            layout: post
         | 
| 38 51 | 
             
            title: #{title}
         | 
| 39 52 | 
             
            ---
         | 
| 40 53 | 
             
            HEADER
         | 
| 41 | 
            -
                      f.puts content
         | 
| 42 54 | 
             
                    end
         | 
| 43 55 | 
             
                  end
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                  def self.build_name(row)
         | 
| 46 | 
            -
                    row[3].split(" ")[0]+"-"+row[1]+(row[4] =~ /markdown/ ? ".markdown" : ".textile")
         | 
| 47 | 
            -
                  end
         | 
| 48 56 | 
             
                end
         | 
| 49 57 | 
             
              end
         | 
| 50 58 | 
             
            end
         | 
| @@ -1,7 +1,3 @@ | |
| 1 | 
            -
            # Usage:
         | 
| 2 | 
            -
            #   (Local file)
         | 
| 3 | 
            -
            #   ruby -r 'jekyll/jekyll-import/rss' -e "JekyllImport::GoogleReader.process(:source => './somefile/on/your/computer.xml')"
         | 
| 4 | 
            -
             | 
| 5 1 | 
             
            module JekyllImport
         | 
| 6 2 | 
             
              module Importers
         | 
| 7 3 | 
             
                class GoogleReader < Importer
         | 
| @@ -21,7 +17,7 @@ module JekyllImport | |
| 21 17 | 
             
                      rss
         | 
| 22 18 | 
             
                      fileutils
         | 
| 23 19 | 
             
                      safe_yaml
         | 
| 24 | 
            -
                      open- | 
| 20 | 
            +
                      open-uri
         | 
| 25 21 | 
             
                      rexml/document
         | 
| 26 22 | 
             
                      date
         | 
| 27 23 | 
             
                    ])
         | 
| @@ -17,11 +17,13 @@ module JekyllImport | |
| 17 17 | 
             
                      sequel
         | 
| 18 18 | 
             
                      fileutils
         | 
| 19 19 | 
             
                      safe_yaml
         | 
| 20 | 
            +
                      unidecode
         | 
| 20 21 | 
             
                    ])
         | 
| 21 22 | 
             
                  end
         | 
| 22 23 |  | 
| 23 24 | 
             
                  def self.specify_options(c)
         | 
| 24 25 | 
             
                    c.option 'dbname', '--dbname DB', 'Database name (default: "")'
         | 
| 26 | 
            +
                    c.option 'socket', '--socket SOCKET', 'Database socket (default: "")'
         | 
| 25 27 | 
             
                    c.option 'user', '--user USER', 'Database user name (default: "")'
         | 
| 26 28 | 
             
                    c.option 'password', '--password PW', "Database user's password (default: "")"
         | 
| 27 29 | 
             
                    c.option 'host', '--host HOST', 'Database host name (default: "localhost")'
         | 
| @@ -41,6 +43,7 @@ module JekyllImport | |
| 41 43 | 
             
                  # user::    The database user name
         | 
| 42 44 | 
             
                  # pass::    The database user's password
         | 
| 43 45 | 
             
                  # host::    The address of the MySQL database host. Default: 'localhost'
         | 
| 46 | 
            +
                  # socket::  The database socket's path
         | 
| 44 47 | 
             
                  # options:: A hash table of configuration options.
         | 
| 45 48 | 
             
                  #
         | 
| 46 49 | 
             
                  # Supported options are:
         | 
| @@ -78,6 +81,7 @@ module JekyllImport | |
| 78 81 | 
             
                      :user           => opts.fetch('user', ''),
         | 
| 79 82 | 
             
                      :pass           => opts.fetch('password', ''),
         | 
| 80 83 | 
             
                      :host           => opts.fetch('host', 'localhost'),
         | 
| 84 | 
            +
                      :socket         => opts.fetch('socket', ''),
         | 
| 81 85 | 
             
                      :dbname         => opts.fetch('dbname', ''),
         | 
| 82 86 | 
             
                      :table_prefix   => opts.fetch('prefix', 'wp_'),
         | 
| 83 87 | 
             
                      :clean_entities => opts.fetch('clean_entities', true),
         | 
| @@ -102,10 +106,31 @@ module JekyllImport | |
| 102 106 | 
             
                    FileUtils.mkdir_p("_posts")
         | 
| 103 107 |  | 
| 104 108 | 
             
                    db = Sequel.mysql2(options[:dbname], :user => options[:user], :password => options[:pass],
         | 
| 105 | 
            -
                                      :host => options[:host], :encoding => 'utf8')
         | 
| 109 | 
            +
                                      :socket => options[:socket], :host => options[:host], :encoding => 'utf8')
         | 
| 106 110 |  | 
| 107 111 | 
             
                    px = options[:table_prefix]
         | 
| 108 112 |  | 
| 113 | 
            +
                    page_name_list = {}
         | 
| 114 | 
            +
             | 
| 115 | 
            +
                    page_name_query = "
         | 
| 116 | 
            +
                       SELECT
         | 
| 117 | 
            +
                         posts.ID            AS `id`,
         | 
| 118 | 
            +
                         posts.post_title    AS `title`,
         | 
| 119 | 
            +
                         posts.post_name     AS `slug`,
         | 
| 120 | 
            +
                         posts.post_parent   AS `parent`
         | 
| 121 | 
            +
                       FROM #{px}posts AS `posts`
         | 
| 122 | 
            +
                       WHERE posts.post_type = 'page'"
         | 
| 123 | 
            +
             | 
| 124 | 
            +
                    db[page_name_query].each do |page|
         | 
| 125 | 
            +
                      if !page[:slug] or page[:slug].empty?
         | 
| 126 | 
            +
                        page[:slug] = sluggify(page[:title])
         | 
| 127 | 
            +
                      end
         | 
| 128 | 
            +
                      page_name_list[ page[:id] ] = {
         | 
| 129 | 
            +
                        :slug   => page[:slug],
         | 
| 130 | 
            +
                        :parent => page[:parent]
         | 
| 131 | 
            +
                      }
         | 
| 132 | 
            +
                    end
         | 
| 133 | 
            +
             | 
| 109 134 | 
             
                    posts_query = "
         | 
| 110 135 | 
             
                       SELECT
         | 
| 111 136 | 
             
                         posts.ID            AS `id`,
         | 
| @@ -138,12 +163,12 @@ module JekyllImport | |
| 138 163 | 
             
                    end
         | 
| 139 164 |  | 
| 140 165 | 
             
                    db[posts_query].each do |post|
         | 
| 141 | 
            -
                      process_post(post, db, options)
         | 
| 166 | 
            +
                      process_post(post, db, options, page_name_list)
         | 
| 142 167 | 
             
                    end
         | 
| 143 168 | 
             
                  end
         | 
| 144 169 |  | 
| 145 170 |  | 
| 146 | 
            -
                  def self.process_post(post, db, options)
         | 
| 171 | 
            +
                  def self.process_post(post, db, options, page_name_list)
         | 
| 147 172 | 
             
                    px = options[:table_prefix]
         | 
| 148 173 |  | 
| 149 174 | 
             
                    title = post[:title]
         | 
| @@ -269,7 +294,12 @@ module JekyllImport | |
| 269 294 | 
             
                      'status'        => post[:status].to_s,
         | 
| 270 295 | 
             
                      'published'     => (post[:status].to_s == "publish"),
         | 
| 271 296 | 
             
                      'title'         => title.to_s,
         | 
| 272 | 
            -
                      'author'        =>  | 
| 297 | 
            +
                      'author'        => {
         | 
| 298 | 
            +
                        'display_name'=> post[:author].to_s,
         | 
| 299 | 
            +
                        'login'       => post[:author_login].to_s,
         | 
| 300 | 
            +
                        'email'       => post[:author_email].to_s,
         | 
| 301 | 
            +
                        'url'  => post[:author_url].to_s,
         | 
| 302 | 
            +
                      },
         | 
| 273 303 | 
             
                      'author_login'  => post[:author_login].to_s,
         | 
| 274 304 | 
             
                      'author_email'  => post[:author_email].to_s,
         | 
| 275 305 | 
             
                      'author_url'    => post[:author_url].to_s,
         | 
| @@ -284,8 +314,15 @@ module JekyllImport | |
| 284 314 | 
             
                      'comments'      => options[:comments] ? comments : nil,
         | 
| 285 315 | 
             
                    }.delete_if { |k,v| v.nil? || v == '' }.to_yaml
         | 
| 286 316 |  | 
| 317 | 
            +
                    if post[:type] == 'page'
         | 
| 318 | 
            +
                      filename = page_path(post[:id], page_name_list) + 'index.markdown'
         | 
| 319 | 
            +
                      FileUtils.mkdir_p(File.dirname(filename))
         | 
| 320 | 
            +
                    else
         | 
| 321 | 
            +
                      filename = "_posts/#{name}"
         | 
| 322 | 
            +
                    end
         | 
| 323 | 
            +
             | 
| 287 324 | 
             
                    # Write out the data and content to file
         | 
| 288 | 
            -
                    File.open( | 
| 325 | 
            +
                    File.open(filename, "w") do |f|
         | 
| 289 326 | 
             
                      f.puts data
         | 
| 290 327 | 
             
                      f.puts "---"
         | 
| 291 328 | 
             
                      f.puts Util.wpautop(content)
         | 
| @@ -311,13 +348,19 @@ module JekyllImport | |
| 311 348 |  | 
| 312 349 |  | 
| 313 350 | 
             
                  def self.sluggify( title )
         | 
| 314 | 
            -
                     | 
| 315 | 
            -
             | 
| 316 | 
            -
             | 
| 317 | 
            -
             | 
| 318 | 
            -
             | 
| 351 | 
            +
                    title = title.to_ascii.downcase.gsub(/[^0-9A-Za-z]+/, " ").strip.gsub(" ", "-")
         | 
| 352 | 
            +
                  end
         | 
| 353 | 
            +
             | 
| 354 | 
            +
                  def self.page_path( page_id, page_name_list )
         | 
| 355 | 
            +
                    if page_name_list.key?(page_id)
         | 
| 356 | 
            +
                      [
         | 
| 357 | 
            +
                        page_path(page_name_list[page_id][:parent],page_name_list),
         | 
| 358 | 
            +
                        page_name_list[page_id][:slug],
         | 
| 359 | 
            +
                        '/'
         | 
| 360 | 
            +
                      ].join("")
         | 
| 361 | 
            +
                    else
         | 
| 362 | 
            +
                      ""
         | 
| 319 363 | 
             
                    end
         | 
| 320 | 
            -
                    title.downcase.gsub(/[^0-9A-Za-z]+/, " ").strip.gsub(" ", "-")
         | 
| 321 364 | 
             
                  end
         | 
| 322 365 |  | 
| 323 366 | 
             
                end
         | 
| @@ -13,19 +13,54 @@ module JekyllImport | |
| 13 13 | 
             
                      safe_yaml
         | 
| 14 14 | 
             
                      hpricot
         | 
| 15 15 | 
             
                      time
         | 
| 16 | 
            +
                      open-uri
         | 
| 16 17 | 
             
                    ])
         | 
| 17 18 | 
             
                  end
         | 
| 18 19 |  | 
| 19 20 | 
             
                  def self.specify_options(c)
         | 
| 20 21 | 
             
                    c.option 'source', '--source FILE', 'WordPress export XML file (default: "wordpress.xml")'
         | 
| 22 | 
            +
                    c.option 'no_fetch_images', '--no-fetch-images', 'Do not fetch the images referenced in the posts'
         | 
| 23 | 
            +
                    c.option 'assets_folder', '--assets_folder FOLDER', 'Folder where assets such as images will be downloaded to (default: assets)'
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  # Will modify post DOM tree
         | 
| 27 | 
            +
                  def self.download_images(title, post_hpricot, assets_folder)
         | 
| 28 | 
            +
                    images = (post_hpricot/"img")
         | 
| 29 | 
            +
                    if images.length == 0
         | 
| 30 | 
            +
                      return
         | 
| 31 | 
            +
                    end
         | 
| 32 | 
            +
                    puts "Downloading images for " + title
         | 
| 33 | 
            +
                    images.each do |i|
         | 
| 34 | 
            +
                      uri = i["src"]
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                      i["src"] = assets_folder + "/" + File.basename(uri)
         | 
| 37 | 
            +
                      dst = File.join(assets_folder, File.basename(uri))
         | 
| 38 | 
            +
                      puts "  " + uri
         | 
| 39 | 
            +
                      if File.exist?(dst)
         | 
| 40 | 
            +
                        puts "    Already in cache. Clean assets folder if you want a redownload."
         | 
| 41 | 
            +
                        next
         | 
| 42 | 
            +
                      end
         | 
| 43 | 
            +
                      begin
         | 
| 44 | 
            +
                        open(uri) {|f|
         | 
| 45 | 
            +
                          File.open(dst, "wb") do |out|
         | 
| 46 | 
            +
                            out.puts f.read
         | 
| 47 | 
            +
                          end
         | 
| 48 | 
            +
                        }
         | 
| 49 | 
            +
                        puts "    OK!"
         | 
| 50 | 
            +
                      rescue => e
         | 
| 51 | 
            +
                        puts "    Errorr: #{e.message}"
         | 
| 52 | 
            +
                      end
         | 
| 53 | 
            +
                    end
         | 
| 21 54 | 
             
                  end
         | 
| 22 55 |  | 
| 23 56 | 
             
                  def self.process(options)
         | 
| 24 | 
            -
                    source | 
| 57 | 
            +
                    source        = options.fetch('source', "wordpress.xml")
         | 
| 58 | 
            +
                    fetch         = !options.fetch('no_fetch_images', false)
         | 
| 59 | 
            +
                    assets_folder = options.fetch('assets_folder', 'assets')
         | 
| 60 | 
            +
                    FileUtils.mkdir_p(assets_folder)
         | 
| 25 61 |  | 
| 26 62 | 
             
                    import_count = Hash.new(0)
         | 
| 27 63 | 
             
                    doc = Hpricot::XML(File.read(source))
         | 
| 28 | 
            -
             | 
| 29 64 | 
             
                    # Fetch authors data from header
         | 
| 30 65 | 
             
                    authors = Hash[
         | 
| 31 66 | 
             
                      (doc/:channel/'wp:author').map do |author|
         | 
| @@ -83,11 +118,17 @@ module JekyllImport | |
| 83 118 | 
             
                      }
         | 
| 84 119 |  | 
| 85 120 | 
             
                      begin
         | 
| 121 | 
            +
                        content = Hpricot(item.at('content:encoded').inner_text)
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                        if fetch
         | 
| 124 | 
            +
                          download_images(title, content, assets_folder)
         | 
| 125 | 
            +
                        end
         | 
| 126 | 
            +
             | 
| 86 127 | 
             
                        FileUtils.mkdir_p "_#{type}s"
         | 
| 87 128 | 
             
                        File.open("_#{type}s/#{name}", "w") do |f|
         | 
| 88 129 | 
             
                          f.puts header.to_yaml
         | 
| 89 130 | 
             
                          f.puts '---'
         | 
| 90 | 
            -
                          f.puts Util.wpautop( | 
| 131 | 
            +
                          f.puts Util.wpautop(content.to_html)
         | 
| 91 132 | 
             
                        end
         | 
| 92 133 | 
             
                      rescue => e
         | 
| 93 134 | 
             
                        puts "Couldn't import post!"
         | 
    
        data/lib/jekyll-import/util.rb
    CHANGED
    
    
    
        data/site/_config.yml
    CHANGED
    
    
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            layout: news_item
         | 
| 3 | 
            +
            title: 'jekyll-import 0.3.0 Released'
         | 
| 4 | 
            +
            date: 2014-05-23 23:06:43 -0400
         | 
| 5 | 
            +
            author: parkr
         | 
| 6 | 
            +
            version: 0.3.0
         | 
| 7 | 
            +
            categories: [release]
         | 
| 8 | 
            +
            ---
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            Hey! This release is just to get a few fixes that have lain stale for a bit
         | 
| 11 | 
            +
            out into the open. Notably, the WordPress and WordPress.com importers have
         | 
| 12 | 
            +
            been markedly improved. Check out the full changelog for more details
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            Highlights:
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            * Import WordPress.org `author` data as hash
         | 
| 17 | 
            +
            * Add `socket` option to the WordPress importer
         | 
| 18 | 
            +
            * Allow the CSV importer to skip writing front matter
         | 
| 19 | 
            +
            * WordPress.com: Download images locally and update links to them
         | 
| 20 | 
            +
            * WordPress: Import WP pages as proper Jekyll pages instead of as posts
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            Happy Jekylling!
         | 
    
        data/site/docs/csv.md
    CHANGED
    
    | @@ -23,3 +23,15 @@ Your file CSV file will be read in with the following columns: | |
| 23 23 | 
             
            3. body
         | 
| 24 24 | 
             
            4. published_at
         | 
| 25 25 | 
             
            5. filter (e.g. markdown, textile)
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            If you wish to specify custom front matter for each of your posts, you
         | 
| 28 | 
            +
            can use the `no-front-matter` option to prevent the default front matter
         | 
| 29 | 
            +
            from being written to the imported files:
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            {% highlight bash %}
         | 
| 32 | 
            +
            $ ruby -rubygems -e 'require "jekyll-import";
         | 
| 33 | 
            +
                JekyllImport::Importers::CSV.run({
         | 
| 34 | 
            +
                  "file" => "my_posts.csv",
         | 
| 35 | 
            +
                  "no-front-matter" => true
         | 
| 36 | 
            +
                })'
         | 
| 37 | 
            +
            {% endhighlight %}
         | 
    
        data/site/docs/history.md
    CHANGED
    
    | @@ -1,10 +1,37 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            layout: docs
         | 
| 3 3 | 
             
            title: History
         | 
| 4 | 
            -
            permalink: /docs/history/
         | 
| 4 | 
            +
            permalink: "/docs/history/"
         | 
| 5 5 | 
             
            prev_section: contributing
         | 
| 6 6 | 
             
            ---
         | 
| 7 7 |  | 
| 8 | 
            +
            ## 0.2.0 / 2014-03-16
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            ### Major Enhancements
         | 
| 11 | 
            +
            - Add comments to MovableType importer ([#66]({{ site.repository }}/issues/66))
         | 
| 12 | 
            +
            - Support auto-paragraph Wordpress convention ([#125]({{ site.repository }}/issues/125))
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            ### Minor Enhancements
         | 
| 15 | 
            +
            - Extract author info from wordpress XML files ([#131]({{ site.repository }}/issues/131))
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            ### Bug Fixes
         | 
| 18 | 
            +
            - Require YAML library in Enki importer ([#112]({{ site.repository }}/issues/112))
         | 
| 19 | 
            +
            - Fix !ruby/string:Sequel::SQL::Blob error in MT excerpts ([#113]({{ site.repository }}/issues/113))
         | 
| 20 | 
            +
            - Drupal6: Ensure post "tags" is "", never nil ([#117]({{ site.repository }}/issues/117))
         | 
| 21 | 
            +
            - Fixes a bug where the Tumblr importer would write posts with `nil`
         | 
| 22 | 
            +
                content ([#118]({{ site.repository }}/issues/118))
         | 
| 23 | 
            +
            - Change Drupal7 layout to `post` rather than `default` ([#124]({{ site.repository }}/issues/124))
         | 
| 24 | 
            +
            - WordPress: Use explicit `#to_s` when outputting post dates ([#129]({{ site.repository }}/issues/129))
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            ### Site Enhancements
         | 
| 27 | 
            +
            - Fixed error in quickstart code, added required design changes/reflow ([#120]({{ site.repository }}/issues/120))
         | 
| 28 | 
            +
            - Fix example parameter names for Tumblr importer ([#122]({{ site.repository }}/issues/122))
         | 
| 29 | 
            +
            - Add note to WordPress installer docs page that indicates what the importer
         | 
| 30 | 
            +
                does and doesn't do. ([#127]({{ site.repository }}/issues/127))
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            ### Development Fixes
         | 
| 33 | 
            +
            - Bring gemspec into the 2010's ([#130]({{ site.repository }}/issues/130))
         | 
| 34 | 
            +
             | 
| 8 35 | 
             
            ## 0.1.0 / 2013-12-18
         | 
| 9 36 |  | 
| 10 37 | 
             
            ### Major Enhancements
         | 
    
        data/site/docs/wordpress.md
    CHANGED
    
    
| @@ -12,11 +12,14 @@ To import your posts from a [WordPress.com](http://wordpress.com) blog, run: | |
| 12 12 | 
             
            {% highlight bash %}
         | 
| 13 13 | 
             
            $ ruby -rubygems -e 'require "jekyll-import";
         | 
| 14 14 | 
             
                JekyllImport::Importers::WordpressDotCom.run({
         | 
| 15 | 
            -
                  "source" => "wordpress.xml"
         | 
| 15 | 
            +
                  "source" => "wordpress.xml",
         | 
| 16 | 
            +
                  "no_fetch_images" => false,
         | 
| 17 | 
            +
                  "assets_folder" => "assets"
         | 
| 16 18 | 
             
                })'
         | 
| 17 19 | 
             
            {% endhighlight %}
         | 
| 18 20 |  | 
| 19 | 
            -
            The `source`  | 
| 21 | 
            +
            The `source`, `no_fetch_images`, and `assets_folder` fields are not required.
         | 
| 22 | 
            +
            Their default values are what you see above.
         | 
| 20 23 |  | 
| 21 24 | 
             
            <div class="note">
         | 
| 22 25 | 
             
              <h5>ProTip™: WordPress.com Export Tool</h5>
         | 
    
        data/test/helper.rb
    CHANGED
    
    | @@ -1,11 +1,10 @@ | |
| 1 | 
            -
            if  | 
| 1 | 
            +
            if ENV["COVERAGE"] == "true"
         | 
| 2 2 | 
             
              require 'simplecov'
         | 
| 3 3 | 
             
              require 'simplecov-gem-adapter'
         | 
| 4 4 | 
             
              SimpleCov.start('gem')
         | 
| 5 5 | 
             
            end
         | 
| 6 6 |  | 
| 7 7 | 
             
            require 'test/unit'
         | 
| 8 | 
            -
            require 'redgreen' if RUBY_VERSION < '1.9'
         | 
| 9 8 | 
             
            require 'shoulda'
         | 
| 10 9 | 
             
            require 'rr'
         | 
| 11 10 |  | 
| @@ -15,14 +14,14 @@ unless defined?(Test::Unit::AssertionFailedError) | |
| 15 14 | 
             
              end
         | 
| 16 15 | 
             
            end
         | 
| 17 16 |  | 
| 18 | 
            -
             | 
| 19 | 
            -
              require f
         | 
| 20 | 
            -
            end
         | 
| 17 | 
            +
            require File.expand_path('../../lib/jekyll-import.rb', __FILE__)
         | 
| 21 18 |  | 
| 22 19 | 
             
            include JekyllImport
         | 
| 23 20 |  | 
| 21 | 
            +
            JekyllImport::Importer.subclasses.each(&:require_deps)
         | 
| 22 | 
            +
             | 
| 24 23 | 
             
            # Send STDERR into the void to suppress program output messages
         | 
| 25 | 
            -
            STDERR.reopen(test(?e, '/dev/null') ? '/dev/null' : 'NUL:')
         | 
| 24 | 
            +
            #STDERR.reopen(test(?e, '/dev/null') ? '/dev/null' : 'NUL:')
         | 
| 26 25 |  | 
| 27 26 | 
             
            class Test::Unit::TestCase
         | 
| 28 27 | 
             
              include RR::Adapters::TestUnit
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: jekyll-import
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Tom Preston-Werner
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014- | 
| 11 | 
            +
            date: 2014-05-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: jekyll
         | 
| @@ -114,14 +114,14 @@ dependencies: | |
| 114 114 | 
             
                requirements:
         | 
| 115 115 | 
             
                - - "~>"
         | 
| 116 116 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version: 3. | 
| 117 | 
            +
                    version: '3.5'
         | 
| 118 118 | 
             
              type: :development
         | 
| 119 119 | 
             
              prerelease: false
         | 
| 120 120 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 121 | 
             
                requirements:
         | 
| 122 122 | 
             
                - - "~>"
         | 
| 123 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            -
                    version: 3. | 
| 124 | 
            +
                    version: '3.5'
         | 
| 125 125 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 126 126 | 
             
              name: rr
         | 
| 127 127 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -262,6 +262,20 @@ dependencies: | |
| 262 262 | 
             
                - - "~>"
         | 
| 263 263 | 
             
                  - !ruby/object:Gem::Version
         | 
| 264 264 | 
             
                    version: '0.3'
         | 
| 265 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 266 | 
            +
              name: unidecode
         | 
| 267 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 268 | 
            +
                requirements:
         | 
| 269 | 
            +
                - - ">="
         | 
| 270 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 271 | 
            +
                    version: '0'
         | 
| 272 | 
            +
              type: :development
         | 
| 273 | 
            +
              prerelease: false
         | 
| 274 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 275 | 
            +
                requirements:
         | 
| 276 | 
            +
                - - ">="
         | 
| 277 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 278 | 
            +
                    version: '0'
         | 
| 265 279 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 266 280 | 
             
              name: launchy
         | 
| 267 281 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -343,6 +357,7 @@ files: | |
| 343 357 | 
             
            - site/_posts/2013-11-18-jekyll-import-0-1-0-rc1-released.markdown
         | 
| 344 358 | 
             
            - site/_posts/2013-12-17-jekyll-import-0-1-0-released.markdown
         | 
| 345 359 | 
             
            - site/_posts/2014-03-16-jekyll-import-0-2-0-released.markdown
         | 
| 360 | 
            +
            - site/_posts/2014-05-23-jekyll-import-0-3-0-released.markdown
         | 
| 346 361 | 
             
            - site/css/gridism.css
         | 
| 347 362 | 
             
            - site/css/normalize.css
         | 
| 348 363 | 
             
            - site/css/pygments.css
         |