jekyll-import 0.1.0.beta2 → 0.1.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/History.markdown +13 -0
- data/jekyll-import.gemspec +3 -2
- data/lib/jekyll/commands/import.rb +1 -0
- data/lib/jekyll/jekyll-import/drupal6.rb +2 -0
- data/lib/jekyll/jekyll-import/drupal7.rb +2 -1
- data/lib/jekyll/jekyll-import/google_reader.rb +61 -0
- data/lib/jekyll/jekyll-import/tumblr.rb +8 -5
- data/lib/jekyll/jekyll-import/wordpressdotcom.rb +3 -1
- data/lib/jekyll-import.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjI5ZmY4ODUyNjIxNTdlNmE1YjllMzVlOWJmYTc0Yjg3OGYyMWUwMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTg5OWNkNTJmYjVmYzczMzFlYzQ5NDE3MmJlZTgxNmI4YjAwMTAzOQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjhlNzU5ZTVlN2Y1NGJiYmU4N2IxMWMyOWU2MzliMDkyMjdhMWM1NzZjZGZh
|
10
|
+
MTViMGE2NDU4MDQyODQ4MWI3M2FhNjNlZGQ2OGQ3MTg0ODc3OGI4NDBkM2U1
|
11
|
+
ZmI0Y2E1ZjM3ZjFlMGVjYzZlNTI4YThlOTRhZWFkZGQwMzk0NDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjVkY2UyYmY3NzFkOGMwYjY0MzE1NzBiNTk5ODgwYTFmMDg3ZDI3MjExNDM3
|
14
|
+
ZWMyMGMzZmRmN2IwNTcxMmYwMGIzYWMxMjcyNTJlM2QwZjk2ZTg2YmMzYTgw
|
15
|
+
YTNiOTM1NjdmZGZlM2Q4ZDRjYTcxMzlhYjViOGRmMTNlMzZiZGE=
|
data/History.markdown
CHANGED
@@ -4,11 +4,19 @@
|
|
4
4
|
* Add the optional ability to include images in a posterous migration (#5)
|
5
5
|
* Posterous archive (unzipped directory) importer added (#12)
|
6
6
|
* Improve MovableType importer (#13)
|
7
|
+
* Add an importer for Google Reader blog exports (#36)
|
8
|
+
* Remove dependency on html2text in the tumblr importer (#33)
|
9
|
+
|
7
10
|
### Minor Enhancements
|
8
11
|
* Various Tumblr Enhancements (#27)
|
9
12
|
* Adding tags to Typo and forcing their encoding to UTF-8 (#11)
|
10
13
|
* S9Y Importer: specify data source using --source option (#18)
|
11
14
|
* Add taxonomy (`tags`) to Drupal6 migration (#15)
|
15
|
+
* Differentiate between categories and tags in the WordpressDotCom
|
16
|
+
importer (#31)
|
17
|
+
* Use tumblr slug for post is available, use that instead (#39, #40)
|
18
|
+
* Drupal 7 importer should use latest revision of a post (#38)
|
19
|
+
|
12
20
|
### Bug Fixes
|
13
21
|
* Remove usage of `Hash#at` in Tumblr importer (#14)
|
14
22
|
* Force encoding of Drupal 6.x titles to UTF-8 (#22)
|
@@ -16,6 +24,11 @@
|
|
16
24
|
* Use MySQL2 adapter for WordPress importer to fix broken front-matter (#20)
|
17
25
|
* Fix WordPress import initialize parameters due to new Jekyll setup (#19)
|
18
26
|
* Fixed misspelling in method name (#17)
|
27
|
+
* Fix Drupal 7 importer so it compares node ID's properly between `node` and
|
28
|
+
`field_data_body` tables (#38)
|
29
|
+
* Fix prefix replacement for Drupal6 (#41)
|
30
|
+
|
19
31
|
### Site Enhancements
|
32
|
+
|
20
33
|
### Development Fixes
|
21
34
|
* Update usage docs in RSS importer (#35)
|
data/jekyll-import.gemspec
CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.required_ruby_version = '>= 1.9.2'
|
6
6
|
|
7
7
|
s.name = 'jekyll-import'
|
8
|
-
s.version = '0.1.0.
|
9
|
-
s.date = '2013-07-
|
8
|
+
s.version = '0.1.0.beta3'
|
9
|
+
s.date = '2013-07-14'
|
10
10
|
s.rubyforge_project = 'jekyll-import'
|
11
11
|
|
12
12
|
s.summary = "Import command for Jekyll (static site generator)."
|
@@ -59,6 +59,7 @@ Gem::Specification.new do |s|
|
|
59
59
|
lib/jekyll/jekyll-import/drupal6.rb
|
60
60
|
lib/jekyll/jekyll-import/drupal7.rb
|
61
61
|
lib/jekyll/jekyll-import/enki.rb
|
62
|
+
lib/jekyll/jekyll-import/google_reader.rb
|
62
63
|
lib/jekyll/jekyll-import/joomla.rb
|
63
64
|
lib/jekyll/jekyll-import/marley.rb
|
64
65
|
lib/jekyll/jekyll-import/mephisto.rb
|
@@ -33,6 +33,8 @@ module JekyllImport
|
|
33
33
|
if prefix != ''
|
34
34
|
QUERY[" node "] = " " + prefix + "node "
|
35
35
|
QUERY[" node_revisions "] = " " + prefix + "node_revisions "
|
36
|
+
QUERY[" term_node "] = " " + prefix + "term_node "
|
37
|
+
QUERY[" term_data "] = " " + prefix + "term_data "
|
36
38
|
end
|
37
39
|
|
38
40
|
FileUtils.mkdir_p "_posts"
|
@@ -22,7 +22,8 @@ module JekyllImport
|
|
22
22
|
FROM node AS n, \
|
23
23
|
field_data_body AS fdb \
|
24
24
|
WHERE (n.type = 'blog' OR n.type = 'story') \
|
25
|
-
AND n.
|
25
|
+
AND n.nid = fdb.entity_id \
|
26
|
+
AND n.vid = fdb.revision_id"
|
26
27
|
|
27
28
|
def self.process(dbname, user, pass, host = 'localhost', prefix = '')
|
28
29
|
db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8')
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Usage:
|
2
|
+
# (Local file)
|
3
|
+
# ruby -r 'jekyll/jekyll-import/rss' -e "JekyllImport::GoogleReader.process(:source => './somefile/on/your/computer.xml')"
|
4
|
+
|
5
|
+
require 'rss'
|
6
|
+
require 'open-uri'
|
7
|
+
require 'fileutils'
|
8
|
+
require 'safe_yaml'
|
9
|
+
|
10
|
+
require 'rexml/document'
|
11
|
+
require 'date'
|
12
|
+
|
13
|
+
module JekyllImport
|
14
|
+
module GoogleReader
|
15
|
+
def self.validate(options)
|
16
|
+
if !options[:source]
|
17
|
+
abort "Missing mandatory option --source."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Process the import.
|
22
|
+
#
|
23
|
+
# source - a URL or a local file String.
|
24
|
+
#
|
25
|
+
# Returns nothing.
|
26
|
+
def self.process(options)
|
27
|
+
validate(options)
|
28
|
+
|
29
|
+
source = options[:source]
|
30
|
+
|
31
|
+
open(source) do |content|
|
32
|
+
feed = RSS::Parser.parse(content)
|
33
|
+
|
34
|
+
raise "There doesn't appear to be any RSS items at the source (#{source}) provided." unless feed
|
35
|
+
|
36
|
+
feed.items.each do |item|
|
37
|
+
title = item.title.content.to_s
|
38
|
+
formatted_date = Date.parse(item.published.to_s)
|
39
|
+
post_name = title.split(%r{ |!|/|:|&|-|$|,}).map do |i|
|
40
|
+
i.downcase if i != ''
|
41
|
+
end.compact.join('-')
|
42
|
+
name = "#{formatted_date}-#{post_name}"
|
43
|
+
|
44
|
+
header = {
|
45
|
+
'layout' => 'post',
|
46
|
+
'title' => title
|
47
|
+
}
|
48
|
+
|
49
|
+
FileUtils.mkdir_p("_posts")
|
50
|
+
|
51
|
+
File.open("_posts/#{name}.html", "w") do |f|
|
52
|
+
f.puts header.to_yaml
|
53
|
+
f.puts "---\n\n"
|
54
|
+
f.puts item.content.content.to_s
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
@@ -110,8 +110,12 @@ module JekyllImport
|
|
110
110
|
end
|
111
111
|
date = Date.parse(post['date']).to_s
|
112
112
|
title = Nokogiri::HTML(title).text
|
113
|
-
slug =
|
114
|
-
|
113
|
+
slug = if post["slug"] && post["slug"].strip != ""
|
114
|
+
post["slug"]
|
115
|
+
else
|
116
|
+
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
|
117
|
+
slug.length > 200 ? slug.slice(0..200) : slug
|
118
|
+
end
|
115
119
|
{
|
116
120
|
:name => "#{date}-#{slug}.#{format}",
|
117
121
|
:header => {
|
@@ -177,15 +181,14 @@ module JekyllImport
|
|
177
181
|
}
|
178
182
|
end
|
179
183
|
|
180
|
-
#
|
181
|
-
# markdown. Preserve HTML tables as per the markdown docs.
|
184
|
+
# Convert preserving HTML tables as per the markdown docs.
|
182
185
|
def self.html_to_markdown(content)
|
183
186
|
preserve = ["table", "tr", "th", "td"]
|
184
187
|
preserve.each do |tag|
|
185
188
|
content.gsub!(/<#{tag}/i, "$$" + tag)
|
186
189
|
content.gsub!(/<\/#{tag}/i, "||" + tag)
|
187
190
|
end
|
188
|
-
content =
|
191
|
+
content = Nokogiri::HTML(content.gsub("'", "''")).text
|
189
192
|
preserve.each do |tag|
|
190
193
|
content.gsub!("$$" + tag, "<" + tag)
|
191
194
|
content.gsub!("||" + tag, "</" + tag)
|
@@ -32,7 +32,8 @@ module JekyllImport
|
|
32
32
|
end
|
33
33
|
|
34
34
|
type = item.at('wp:post_type').inner_text
|
35
|
-
|
35
|
+
categories = item.search('category[@domain="category"]').map{|c| c.inner_text}.reject{|c| c == 'Uncategorized'}.uniq
|
36
|
+
tags = item.search('category[@domain="post_tag"]').map{|t| t.inner_text}.uniq
|
36
37
|
|
37
38
|
metas = Hash.new
|
38
39
|
item.search("wp:postmeta").each do |meta|
|
@@ -45,6 +46,7 @@ module JekyllImport
|
|
45
46
|
header = {
|
46
47
|
'layout' => type,
|
47
48
|
'title' => title,
|
49
|
+
'categories' => categories,
|
48
50
|
'tags' => tags,
|
49
51
|
'status' => status,
|
50
52
|
'type' => type,
|
data/lib/jekyll-import.rb
CHANGED
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.1.0.
|
4
|
+
version: 0.1.0.beta3
|
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: 2013-07-
|
11
|
+
date: 2013-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -268,6 +268,7 @@ files:
|
|
268
268
|
- lib/jekyll/jekyll-import/drupal6.rb
|
269
269
|
- lib/jekyll/jekyll-import/drupal7.rb
|
270
270
|
- lib/jekyll/jekyll-import/enki.rb
|
271
|
+
- lib/jekyll/jekyll-import/google_reader.rb
|
271
272
|
- lib/jekyll/jekyll-import/joomla.rb
|
272
273
|
- lib/jekyll/jekyll-import/marley.rb
|
273
274
|
- lib/jekyll/jekyll-import/mephisto.rb
|