jekyll-import 0.21.0 → 0.22.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/README.markdown +2 -1
- data/lib/jekyll/commands/import.rb +1 -1
- data/lib/jekyll-import/importers/blogger.rb +3 -3
- data/lib/jekyll-import/importers/csv.rb +2 -2
- data/lib/jekyll-import/importers/dotclear.rb +147 -88
- data/lib/jekyll-import/importers/drupal_common.rb +3 -3
- data/lib/jekyll-import/importers/easyblog.rb +7 -7
- data/lib/jekyll-import/importers/enki.rb +4 -4
- data/lib/jekyll-import/importers/joomla.rb +8 -8
- data/lib/jekyll-import/importers/joomla3.rb +8 -8
- data/lib/jekyll-import/importers/jrnl.rb +4 -4
- data/lib/jekyll-import/importers/marley.rb +1 -1
- data/lib/jekyll-import/importers/medium.rb +36 -0
- data/lib/jekyll-import/importers/mephisto.rb +3 -3
- data/lib/jekyll-import/importers/mt.rb +10 -10
- data/lib/jekyll-import/importers/pluxml.rb +3 -3
- data/lib/jekyll-import/importers/roller.rb +12 -12
- data/lib/jekyll-import/importers/rss.rb +28 -9
- data/lib/jekyll-import/importers/s9y_database.rb +20 -20
- data/lib/jekyll-import/importers/textpattern.rb +5 -5
- data/lib/jekyll-import/importers/tumblr.rb +5 -5
- data/lib/jekyll-import/importers/typo.rb +6 -6
- data/lib/jekyll-import/importers/wordpress.rb +16 -16
- data/lib/jekyll-import/importers/wordpressdotcom.rb +3 -3
- data/lib/jekyll-import/version.rb +1 -1
- metadata +29 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba591570a71e1a96e2a064ba583010d114d8051d9cb4fa810ff45a7e382b621e
|
4
|
+
data.tar.gz: ac515c173bc2bb258d75da253cbdd83aa5f3a9074a97ba8c68a02193b4d15449
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 716d363903258758c63a266d81a865bee73e174816d9cdd854f8d8079511ec3b75fccb1576aa82700b3212c8fa4fe59144196f0e4010084489c7e7c0f8127268
|
7
|
+
data.tar.gz: 65a01c5fbf3b3d69d2a2808ea2e4233b6a7034e056e91950487cdef84d03d9048ea95fefd52eb8b48cd3e0608bfb269b6ef35d347ab59e94a698779088d57069
|
data/README.markdown
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# jekyll-import
|
2
2
|
|
3
|
-
[](https://rubygems.org/gems/jekyll-import)
|
4
|
+
[](https://github.com/jekyll/jekyll-import/actions/workflows/ci.yml)
|
4
5
|
|
5
6
|
The new __Jekyll__ command for importing from various blogs to Jekyll format.
|
6
7
|
|
@@ -39,7 +39,7 @@ module Jekyll
|
|
39
39
|
if args.empty?
|
40
40
|
Jekyll.logger.warn "You must specify an importer."
|
41
41
|
Jekyll.logger.info "Valid options are:"
|
42
|
-
importers.each { |i| Jekyll.logger.info "*", i.to_s }
|
42
|
+
importers.sort.each { |i| Jekyll.logger.info "*", i.to_s }
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -5,9 +5,9 @@ module JekyllImport
|
|
5
5
|
class Blogger < Importer
|
6
6
|
def self.specify_options(c)
|
7
7
|
c.option "source", "--source NAME", "The XML file (blog-MM-DD-YYYY.xml) path to import"
|
8
|
-
c.option "no-blogger-info", "--no-blogger-info", "not to leave blogger-URL info (id and old URL) in the front matter (default: false)"
|
8
|
+
c.option "no-blogger-info", "--no-blogger-info", "not to leave blogger-URL info (id and old URL) in the front matter. (default: false)"
|
9
9
|
c.option "replace-internal-link", "--replace-internal-link", "replace internal links using the post_url liquid tag. (default: false)"
|
10
|
-
c.option "comments", "--comments", "import comments to _comments collection"
|
10
|
+
c.option "comments", "--comments", "import comments to _comments collection. (default: false)"
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.validate(options)
|
@@ -194,7 +194,7 @@ module JekyllImport
|
|
194
194
|
|
195
195
|
FileUtils.mkdir_p(target_dir)
|
196
196
|
|
197
|
-
file_name = URI.
|
197
|
+
file_name = URI::DEFAULT_PARSER.unescape("#{post_data[:filename]}.html")
|
198
198
|
File.open(File.join(target_dir, file_name), "w") do |f|
|
199
199
|
f.flock(File::LOCK_EX)
|
200
200
|
|
@@ -12,8 +12,8 @@ module JekyllImport
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.specify_options(c)
|
15
|
-
c.option "file", "--file NAME",
|
16
|
-
c.option "no-front-matter", "--no-front-matter", "Do not add the default front matter to the post body"
|
15
|
+
c.option "file", "--file NAME", "The CSV file to import. (default: 'posts.csv')"
|
16
|
+
c.option "no-front-matter", "--no-front-matter", "Do not add the default front matter to the post body. (default: false)"
|
17
17
|
end
|
18
18
|
|
19
19
|
# Reads a csv with title, permalink, body, published_at, and filter.
|
@@ -1,121 +1,180 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Tested with dotClear 2.1.5
|
4
3
|
module JekyllImport
|
5
4
|
module Importers
|
6
5
|
class Dotclear < Importer
|
7
|
-
|
8
|
-
c
|
9
|
-
|
10
|
-
|
6
|
+
class << self
|
7
|
+
def specify_options(c)
|
8
|
+
c.option "datafile", "--datafile PATH", "Dotclear export file."
|
9
|
+
c.option "mediafolder", "--mediafolder DIR", "Dotclear media export folder (unpacked media.zip)."
|
10
|
+
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
fileutils
|
16
|
-
safe_yaml
|
17
|
-
date
|
18
|
-
active_support
|
19
|
-
active_support/core_ext/string/inflections
|
20
|
-
csv
|
21
|
-
pp
|
22
|
-
))
|
23
|
-
end
|
12
|
+
def require_deps
|
13
|
+
JekyllImport.require_with_fallback(%w())
|
14
|
+
end
|
24
15
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
16
|
+
def validate(opts)
|
17
|
+
file_path = opts["datafile"]
|
18
|
+
log_undefined_flag_error("datafile") if file_path.nil? || file_path.empty?
|
29
19
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
20
|
+
file_path = File.expand_path(file_path)
|
21
|
+
if File.open(file_path, "rb", &:readline).start_with?("///DOTCLEAR|")
|
22
|
+
@data = read_export(file_path)
|
23
|
+
Jekyll.logger.info "Export File:", file_path
|
24
|
+
else
|
25
|
+
Jekyll.logger.abort_with "Import Error:", "#{file_path.inspect} is not a valid Dotclear export file!"
|
26
|
+
end
|
37
27
|
|
38
|
-
|
39
|
-
|
40
|
-
:datafile => opts.fetch("datafile", ""),
|
41
|
-
:mediafolder => opts.fetch("mediafolder", ""),
|
42
|
-
}
|
28
|
+
assets = @data["media"]
|
29
|
+
return if !assets || assets.empty?
|
43
30
|
|
44
|
-
|
45
|
-
FileUtils.mkdir_p("_drafts")
|
31
|
+
Jekyll.logger.info "", "Media files detected in export data."
|
46
32
|
|
47
|
-
|
48
|
-
|
49
|
-
posts_and_drafts = {}
|
50
|
-
keywords = {}
|
33
|
+
media_dir = opts["mediafolder"]
|
34
|
+
log_undefined_flag_error("mediafolder") if media_dir.nil? || media_dir.empty?
|
51
35
|
|
52
|
-
|
53
|
-
|
36
|
+
media_dir = File.expand_path(media_dir)
|
37
|
+
log_invalid_media_dir_error(media_dir) if !File.directory?(media_dir) || Dir.empty?(media_dir)
|
38
|
+
end
|
54
39
|
|
55
|
-
|
40
|
+
def process(opts)
|
41
|
+
import_posts
|
42
|
+
import_assets(opts["mediafolder"])
|
43
|
+
Jekyll.logger.info "", "and, done!"
|
44
|
+
end
|
56
45
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
46
|
+
private
|
47
|
+
|
48
|
+
# Parse backup sections into a Hash of arrays.
|
49
|
+
#
|
50
|
+
# Each section is of following shape:
|
51
|
+
#
|
52
|
+
# [key alpha,beta,gamma,...]
|
53
|
+
# lorem,ipsum,dolor,...
|
54
|
+
# red,blue,green,...
|
55
|
+
#
|
56
|
+
# Returns Hash of shape:
|
57
|
+
#
|
58
|
+
# {key => [{alpha => lorem,...}, {alpha => red,...}]}
|
59
|
+
#
|
60
|
+
def read_export(file)
|
61
|
+
ignored_sections = %w(category comment link setting)
|
62
|
+
|
63
|
+
File.read(file, :encoding => "utf-8").split("\n\n").each_with_object({}) do |section, data|
|
64
|
+
next unless %r!^\[(?<key>.*?) (?<header>.*)\]\n(?<rows>.*)!m =~ section
|
65
|
+
next if ignored_sections.include?(key)
|
66
|
+
|
67
|
+
headers = header.split(",")
|
68
|
+
|
69
|
+
data[key] = rows.each_line.with_object([]) do |line, bucket|
|
70
|
+
bucket << headers.zip(sanitize_line!(line)).to_h
|
71
|
+
end
|
72
|
+
|
73
|
+
data
|
61
74
|
end
|
75
|
+
end
|
62
76
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
draft = (elts[headers[type_data].index("post_status")] != "1")
|
77
|
+
def register_post_tags
|
78
|
+
@data["meta"].each_with_object({}) do |entry, tags|
|
79
|
+
next unless entry["meta_type"] == "tag"
|
67
80
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
81
|
+
post_id = entry["post_id"]
|
82
|
+
tags[post_id] ||= []
|
83
|
+
tags[post_id] << entry["meta_id"]
|
84
|
+
end
|
85
|
+
end
|
72
86
|
|
73
|
-
|
74
|
-
|
87
|
+
def log_undefined_flag_error(label)
|
88
|
+
Jekyll.logger.abort_with "Import Error:", "--#{label} flag cannot be undefined, null or empty!"
|
89
|
+
end
|
75
90
|
|
76
|
-
|
91
|
+
def log_invalid_media_dir_error(media_dir)
|
92
|
+
Jekyll.logger.error "Import Error:", "--mediafolder should be a non-empty directory."
|
93
|
+
Jekyll.logger.abort_with "", "Please check #{media_dir.inspect}."
|
94
|
+
end
|
77
95
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
96
|
+
def sanitize_line!(line)
|
97
|
+
line.strip!
|
98
|
+
line.split('","').tap do |items|
|
99
|
+
items[0].delete_prefix!('"')
|
100
|
+
items[-1].delete_suffix!('"')
|
101
|
+
end
|
102
|
+
end
|
85
103
|
|
86
|
-
|
87
|
-
POST_FILE
|
104
|
+
# -
|
88
105
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
106
|
+
REPLACE_MAP = {
|
107
|
+
'\"' => '"',
|
108
|
+
'\r\n' => "\n",
|
109
|
+
'\n' => "\n",
|
110
|
+
"/dotclear/public/" => "/assets/dotclear/",
|
111
|
+
"/public/" => "/assets/dotclear/",
|
112
|
+
}.freeze
|
93
113
|
|
94
|
-
|
95
|
-
dst_path = File.join(Dir.pwd, "assets", "images", mediafilepath.to_s)
|
114
|
+
REPLACE_RE = Regexp.union(REPLACE_MAP.keys)
|
96
115
|
|
97
|
-
|
98
|
-
FileUtils.cp(src_path, dst_path)
|
99
|
-
elsif type_data == "meta"
|
100
|
-
keywords[elts[headers[type_data].index("post_id")]] ||= []
|
101
|
-
keywords[elts[headers[type_data].index("post_id")]] << elts[headers[type_data].index("meta_id")]
|
102
|
-
elsif type_data == "link"
|
116
|
+
private_constant :REPLACE_MAP, :REPLACE_RE
|
103
117
|
|
104
|
-
|
118
|
+
# -
|
105
119
|
|
106
|
-
|
120
|
+
def adjust_post_contents!(content)
|
121
|
+
content.strip!
|
122
|
+
content.gsub!(REPLACE_RE, REPLACE_MAP)
|
123
|
+
content
|
124
|
+
end
|
107
125
|
|
126
|
+
def import_posts
|
127
|
+
tags = register_post_tags
|
128
|
+
posts = @data["post"]
|
129
|
+
|
130
|
+
FileUtils.mkdir_p("_drafts") unless posts.empty?
|
131
|
+
Jekyll.logger.info "Importing posts.."
|
132
|
+
|
133
|
+
posts.each do |post|
|
134
|
+
date, title = post.values_at("post_creadt", "post_title")
|
135
|
+
path = File.join("_drafts", Date.parse(date).strftime("%Y-%m-%d-") + Jekyll::Utils.slugify(title) + ".html")
|
136
|
+
|
137
|
+
excerpt = adjust_post_contents!(post["post_excerpt_xhtml"].to_s)
|
138
|
+
excerpt = nil if excerpt.empty?
|
139
|
+
|
140
|
+
# Unlike the paradigm in Jekyll-generated HTML, `post_content_xhtml` in the export data
|
141
|
+
# doesn't begin with `post_excerpt_xhtml`.
|
142
|
+
# Instead of checking whether the excerpt content exists elsewhere in the exported content
|
143
|
+
# string, always prepend excerpt onto content with an empty line in between.
|
144
|
+
content = [excerpt, post["post_content_xhtml"]].tap(&:compact!).join("\n\n")
|
145
|
+
|
146
|
+
front_matter_data = {
|
147
|
+
"layout" => "post",
|
148
|
+
"title" => title,
|
149
|
+
"date" => date,
|
150
|
+
"lang" => post["post_lang"],
|
151
|
+
"tags" => tags[post["post_id"]],
|
152
|
+
"original_url" => post["post_url"], # URL as included in the export-file.
|
153
|
+
"excerpt" => excerpt,
|
154
|
+
}.tap(&:compact!)
|
155
|
+
|
156
|
+
Jekyll.logger.info "Creating:", path
|
157
|
+
File.write(path, "#{YAML.dump(front_matter_data)}---\n\n#{adjust_post_contents!(content)}\n")
|
108
158
|
end
|
109
159
|
end
|
110
160
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
161
|
+
def import_assets(src_dir)
|
162
|
+
assets = @data["media"]
|
163
|
+
FileUtils.mkdir_p("assets/dotclear") if assets && !assets.empty?
|
164
|
+
Jekyll.logger.info "Importing assets.."
|
165
|
+
|
166
|
+
assets.each do |asset|
|
167
|
+
file_path = File.join(src_dir, asset["media_file"])
|
168
|
+
if File.exist?(file_path)
|
169
|
+
dest_path = File.join("assets/dotclear", asset["media_file"])
|
170
|
+
FileUtils.mkdir_p(File.dirname(dest_path))
|
171
|
+
|
172
|
+
Jekyll.logger.info "Copying:", file_path
|
173
|
+
Jekyll.logger.info "To:", dest_path
|
174
|
+
FileUtils.cp_r file_path, dest_path
|
175
|
+
else
|
176
|
+
Jekyll.logger.info "Not found:", file_path
|
177
|
+
end
|
119
178
|
end
|
120
179
|
end
|
121
180
|
end
|
@@ -16,16 +16,16 @@ module JekyllImport
|
|
16
16
|
DEFAULTS = {
|
17
17
|
"engine" => "mysql",
|
18
18
|
"password" => "",
|
19
|
-
"host" => "
|
19
|
+
"host" => "127.0.0.1",
|
20
20
|
"prefix" => "",
|
21
21
|
"port" => "3306",
|
22
22
|
"types" => %w(blog story article),
|
23
23
|
}.freeze
|
24
24
|
|
25
25
|
def specify_options(c)
|
26
|
-
c.option "engine", "--engine [mysql|postgresql]", "Database engine (default: #{DEFAULTS["engine"].inspect})"
|
27
26
|
c.option "dbname", "--dbname DB", "Database name"
|
28
27
|
c.option "user", "--user USER", "Database user name"
|
28
|
+
c.option "engine", "--engine [mysql|postgresql]", "Database engine (default: #{DEFAULTS["engine"].inspect})"
|
29
29
|
c.option "password", "--password PW", "Database user's password (default: #{DEFAULTS["password"].inspect})"
|
30
30
|
c.option "host", "--host HOST", "Database host name (default: #{DEFAULTS["host"].inspect})"
|
31
31
|
c.option "port", "--port PORT", "Database port name (default: #{DEFAULTS["port"].inspect})"
|
@@ -47,9 +47,9 @@ module JekyllImport
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def process(options)
|
50
|
-
engine = options.fetch("engine", DEFAULTS["engine"])
|
51
50
|
dbname = options.fetch("dbname")
|
52
51
|
user = options.fetch("user")
|
52
|
+
engine = options.fetch("engine", DEFAULTS["engine"])
|
53
53
|
pass = options.fetch("password", DEFAULTS["password"])
|
54
54
|
host = options.fetch("host", DEFAULTS["host"])
|
55
55
|
port = options.fetch("port", DEFAULTS["port"])
|
@@ -10,12 +10,12 @@ module JekyllImport
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.specify_options(c)
|
13
|
-
c.option "dbname", "--dbname", "Database name"
|
14
|
-
c.option "user", "--user", "Database user name"
|
15
|
-
c.option "password", "--password", "Database user's password (default: '')"
|
16
|
-
c.option "host", "--host", "Database host name"
|
17
|
-
c.option "section", "--section", "
|
18
|
-
c.option "prefix", "--prefix", "Table prefix name"
|
13
|
+
c.option "dbname", "--dbname", "Database name."
|
14
|
+
c.option "user", "--user", "Database user name."
|
15
|
+
c.option "password", "--password", "Database user's password. (default: '')"
|
16
|
+
c.option "host", "--host", "Database host name. (default: 'localhost')"
|
17
|
+
c.option "section", "--section", "Section ID. (default: '1')"
|
18
|
+
c.option "prefix", "--prefix", "Table prefix name. (default: 'jos_')"
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.require_deps
|
@@ -32,7 +32,7 @@ module JekyllImport
|
|
32
32
|
dbname = options.fetch("dbname")
|
33
33
|
user = options.fetch("user")
|
34
34
|
pass = options.fetch("password", "")
|
35
|
-
host = options.fetch("host", "
|
35
|
+
host = options.fetch("host", "127.0.0.1")
|
36
36
|
section = options.fetch("section", "1")
|
37
37
|
table_prefix = options.fetch("prefix", "jos_")
|
38
38
|
|
@@ -20,10 +20,10 @@ module JekyllImport
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.specify_options(c)
|
23
|
-
c.option "dbname", "--dbname", "Database name"
|
24
|
-
c.option "user", "--user", "
|
25
|
-
c.option "password", "--password",
|
26
|
-
c.option "host", "--host", "Database name"
|
23
|
+
c.option "dbname", "--dbname", "Database name."
|
24
|
+
c.option "user", "--user", "User name."
|
25
|
+
c.option "password", "--password", "Database password. (default: '')"
|
26
|
+
c.option "host", "--host", "Database host name. (default: 'localhost')"
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.require_deps
|
@@ -10,13 +10,13 @@ module JekyllImport
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.specify_options(c)
|
13
|
-
c.option "dbname", "--dbname", "Database name"
|
14
|
-
c.option "user", "--user", "Database user name"
|
15
|
-
c.option "password", "--password", "Database user's password (default: '')"
|
16
|
-
c.option "host", "--host", "Database host name"
|
17
|
-
c.option "port", "--port", "Database port"
|
18
|
-
c.option "section", "--section", "
|
19
|
-
c.option "prefix", "--prefix", "Table prefix name"
|
13
|
+
c.option "dbname", "--dbname", "Database name."
|
14
|
+
c.option "user", "--user", "Database user name."
|
15
|
+
c.option "password", "--password", "Database user's password. (default: '')"
|
16
|
+
c.option "host", "--host", "Database host name. (default: 'localhost')"
|
17
|
+
c.option "port", "--port", "Database port. (default: '3306')"
|
18
|
+
c.option "section", "--section", "Section ID. (default: '1')"
|
19
|
+
c.option "prefix", "--prefix", "Table prefix name. (default: 'jos_')"
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.require_deps
|
@@ -33,7 +33,7 @@ module JekyllImport
|
|
33
33
|
dbname = options.fetch("dbname")
|
34
34
|
user = options.fetch("user")
|
35
35
|
pass = options.fetch("password", "")
|
36
|
-
host = options.fetch("host", "
|
36
|
+
host = options.fetch("host", "127.0.0.1")
|
37
37
|
port = options.fetch("port", 3306).to_i
|
38
38
|
section = options.fetch("section", "1")
|
39
39
|
table_prefix = options.fetch("prefix", "jos_")
|
@@ -10,13 +10,13 @@ module JekyllImport
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.specify_options(c)
|
13
|
-
c.option "dbname", "--dbname", "Database name"
|
14
|
-
c.option "user", "--user", "Database user name"
|
15
|
-
c.option "password", "--password", "Database user's password (default: '')"
|
16
|
-
c.option "host", "--host", "Database host name"
|
17
|
-
c.option "port", "--port", "Database port"
|
18
|
-
c.option "category", "--category", "ID of the category"
|
19
|
-
c.option "prefix", "--prefix", "Table prefix name"
|
13
|
+
c.option "dbname", "--dbname", "Database name."
|
14
|
+
c.option "user", "--user", "Database user name."
|
15
|
+
c.option "password", "--password", "Database user's password. (default: '')"
|
16
|
+
c.option "host", "--host", "Database host name. (default: 'localhost')"
|
17
|
+
c.option "port", "--port", "Database port. (default: '3306')"
|
18
|
+
c.option "category", "--category", "ID of the category. (default: '0')"
|
19
|
+
c.option "prefix", "--prefix", "Table prefix name. (default: 'jos_')"
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.require_deps
|
@@ -33,7 +33,7 @@ module JekyllImport
|
|
33
33
|
dbname = options.fetch("dbname")
|
34
34
|
user = options.fetch("user")
|
35
35
|
pass = options.fetch("password", "")
|
36
|
-
host = options.fetch("host", "
|
36
|
+
host = options.fetch("host", "127.0.0.1")
|
37
37
|
port = options.fetch("port", 3306).to_i
|
38
38
|
cid = options.fetch("category", 0)
|
39
39
|
table_prefix = options.fetch("prefix", "jos_")
|
@@ -12,10 +12,10 @@ module JekyllImport
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.specify_options(c)
|
15
|
-
c.option "file", "--file FILENAME",
|
16
|
-
c.option "time_format", "--time_format FORMAT",
|
17
|
-
c.option "extension", "--extension EXT",
|
18
|
-
c.option "layout", "--layout NAME",
|
15
|
+
c.option "file", "--file FILENAME", "Journal file. (default: '~/journal.txt')"
|
16
|
+
c.option "time_format", "--time_format FORMAT", "Time format of your journal. (default: '%Y-%m-%d %H:%M')"
|
17
|
+
c.option "extension", "--extension EXT", "Output extension. (default: 'md')"
|
18
|
+
c.option "layout", "--layout NAME", "Output post layout. (default: 'post')"
|
19
19
|
end
|
20
20
|
|
21
21
|
# Reads a jrnl file and creates a new post for each entry
|
@@ -28,7 +28,7 @@ module JekyllImport
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.specify_options(c)
|
31
|
-
c.option "marley_data_dir", "--marley_data_dir DIR", "The dir containing your marley data"
|
31
|
+
c.option "marley_data_dir", "--marley_data_dir DIR", "The dir containing your marley data."
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.process(options)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JekyllImport
|
4
|
+
module Importers
|
5
|
+
class Medium < Importer
|
6
|
+
def self.specify_options(c)
|
7
|
+
c.option "username", "--username NAME", "Medium username"
|
8
|
+
c.option "canonical_link", "--canonical_link", "Copy original link as canonical_url to post (default: false)"
|
9
|
+
c.option "render_audio", "--render_audio", "Render <audio> element in posts for the enclosure URLs (default: false)"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.validate(options)
|
13
|
+
abort "Missing mandatory option --username." if options["username"].nil?
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.require_deps
|
17
|
+
Importers::RSS.require_deps
|
18
|
+
end
|
19
|
+
|
20
|
+
# Medium posts and associated metadata are exported as an RSS Feed. Hence invoke our RSS Importer to create the
|
21
|
+
# Jekyll source directory.
|
22
|
+
#
|
23
|
+
# "Tags" attached to a Medium post are exported under the markup `<item><category>...</category></item>` in the
|
24
|
+
# export feed. Therefore, configure the RSS Importer to always look for tags in the `<category></category>` field
|
25
|
+
# of an RSS item.
|
26
|
+
def self.process(options)
|
27
|
+
Importers::RSS.process({
|
28
|
+
"source" => "https://medium.com/feed/@#{options.fetch("username")}",
|
29
|
+
"render_audio" => options.fetch("render_audio", false),
|
30
|
+
"canonical_link" => options.fetch("canonical_link", false),
|
31
|
+
"extract_tags" => "category",
|
32
|
+
})
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -14,7 +14,7 @@ module JekyllImport
|
|
14
14
|
COPY jekyll TO STDOUT WITH CSV HEADER;
|
15
15
|
ROLLBACK;
|
16
16
|
SQL
|
17
|
-
command = %(psql -h #{c[:host] || "
|
17
|
+
command = %(psql -h #{c[:host] || "127.0.0.1"} -c "#{sql.strip}" #{c[:database]} #{c[:username]} -o #{c[:filename] || "posts.csv"})
|
18
18
|
Jekyll.logger.info "Executing:", command
|
19
19
|
`#{command}`
|
20
20
|
CSV.process
|
@@ -40,7 +40,7 @@ module JekyllImport
|
|
40
40
|
c.option "dbname", "--dbname DB", "Database name"
|
41
41
|
c.option "user", "--user USER", "Database user name"
|
42
42
|
c.option "password", "--password PW", "Database user's password (default: '')"
|
43
|
-
c.option "host", "--host HOST",
|
43
|
+
c.option "host", "--host HOST", "Database host name (default: 'localhost')"
|
44
44
|
end
|
45
45
|
|
46
46
|
# This query will pull blog posts from all entries across all blogs. If
|
@@ -61,7 +61,7 @@ module JekyllImport
|
|
61
61
|
dbname = options.fetch("dbname")
|
62
62
|
user = options.fetch("user")
|
63
63
|
pass = options.fetch("password", "")
|
64
|
-
host = options.fetch("host", "
|
64
|
+
host = options.fetch("host", "127.0.0.1")
|
65
65
|
|
66
66
|
db = Sequel.mysql2(dbname, :user => user,
|
67
67
|
:password => pass,
|
@@ -32,17 +32,17 @@ module JekyllImport
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.specify_options(c)
|
35
|
-
c.option "
|
36
|
-
c.option "
|
37
|
-
c.option "
|
38
|
-
c.option "password", "--password PW", "Database user's password
|
39
|
-
c.option "host", "--host HOST",
|
40
|
-
c.option "port", "--port PORT", "Custom database port connect to (
|
41
|
-
c.option "blog_id", "--blog_id ID", "Specify a single Movable Type blog ID to import (default: all blogs)"
|
42
|
-
c.option "categories", "--categories", "
|
35
|
+
c.option "dbname", "--dbname DB", "Database name."
|
36
|
+
c.option "user", "--user USER", "Database user name."
|
37
|
+
c.option "engine", "--engine ENGINE", "Database engine ('mysql' or 'postgres'). (default: 'mysql')"
|
38
|
+
c.option "password", "--password PW", "Database user's password. (default: '')"
|
39
|
+
c.option "host", "--host HOST", "Database host name. (default: 'localhost')"
|
40
|
+
c.option "port", "--port PORT", "Custom database port connect to. (default: null)"
|
41
|
+
c.option "blog_id", "--blog_id ID", "Specify a single Movable Type blog ID to import. (default: null (all blogs))"
|
42
|
+
c.option "categories", "--categories", "When true, save post's categories in its YAML front matter. (default: true)"
|
43
43
|
c.option "src_encoding", "--src_encoding ENCODING", "Encoding of strings from database. (default: UTF-8)"
|
44
44
|
c.option "dest_encoding", "--dest_encoding ENCODING", "Encoding of output strings. (default: UTF-8)"
|
45
|
-
c.option "comments", "--comments", "
|
45
|
+
c.option "comments", "--comments", "When true, output comments in `_comments` directory. (default: false)"
|
46
46
|
end
|
47
47
|
|
48
48
|
# By default this migrator will include posts for all your MovableType blogs.
|
@@ -242,7 +242,7 @@ module JekyllImport
|
|
242
242
|
Sequel.sqlite(dbname)
|
243
243
|
when "mysql", "postgres"
|
244
244
|
db_connect_opts = {
|
245
|
-
:host => options.fetch("host", "
|
245
|
+
:host => options.fetch("host", "127.0.0.1"),
|
246
246
|
:user => options.fetch("user"),
|
247
247
|
:password => options.fetch("password", ""),
|
248
248
|
}
|
@@ -12,9 +12,9 @@ module JekyllImport
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.specify_options(c)
|
15
|
-
c.option "source",
|
16
|
-
c.option "layout",
|
17
|
-
c.option "avoid_liquid", "--avoid_liquid
|
15
|
+
c.option "source", "--source NAME", "The PluXml data directory to import."
|
16
|
+
c.option "layout", "--layout NAME", "The layout to apply. (default: 'post')"
|
17
|
+
c.option "avoid_liquid", "--avoid_liquid", "Will add `render_with_liquid: false` in front matter. (default: false)"
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.validate(options)
|
@@ -14,19 +14,19 @@ module JekyllImport
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.specify_options(c)
|
17
|
-
c.option "dbname", "--dbname DB", "Database name
|
18
|
-
c.option "
|
19
|
-
c.option "
|
20
|
-
c.option "
|
21
|
-
c.option "host", "--host HOST", "Database host name (default: 'localhost')"
|
22
|
-
c.option "port", "--port PORT", "Database port number (default: '3306')"
|
23
|
-
c.option "clean_entities", "--clean_entities", "Whether to clean entities (default: true)"
|
24
|
-
c.option "comments", "--comments", "Whether to import comments (default: true)"
|
25
|
-
c.option "categories", "--categories", "Whether to import categories (default: true)"
|
26
|
-
c.option "tags", "--tags", "Whether to import tags (default: true)"
|
17
|
+
c.option "dbname", "--dbname DB", "Database name."
|
18
|
+
c.option "user", "--user USER", "Database user name."
|
19
|
+
c.option "password", "--password PW", "Database user's password."
|
20
|
+
c.option "socket", "--socket SOCKET", "Database socket. (default: null)"
|
21
|
+
c.option "host", "--host HOST", "Database host name. (default: 'localhost')"
|
22
|
+
c.option "port", "--port PORT", "Database port number. (default: '3306')"
|
23
|
+
c.option "clean_entities", "--clean_entities", "Whether to clean entities. (default: true)"
|
24
|
+
c.option "comments", "--comments", "Whether to import comments. (default: true)"
|
25
|
+
c.option "categories", "--categories", "Whether to import categories. (default: true)"
|
26
|
+
c.option "tags", "--tags", "Whether to import tags. (default: true)"
|
27
27
|
|
28
28
|
c.option "status", "--status STATUS,STATUS2", Array,
|
29
|
-
"Array of allowed statuses (
|
29
|
+
"Array of allowed statuses (either ['PUBLISHED'] or ['DRAFT']). (default: ['PUBLISHED'])"
|
30
30
|
end
|
31
31
|
|
32
32
|
# Main migrator function. Call this to perform the migration.
|
@@ -64,7 +64,7 @@ module JekyllImport
|
|
64
64
|
options = {
|
65
65
|
:user => opts.fetch("user", ""),
|
66
66
|
:pass => opts.fetch("password", ""),
|
67
|
-
:host => opts.fetch("host", "
|
67
|
+
:host => opts.fetch("host", "127.0.0.1"),
|
68
68
|
:port => opts.fetch("port", "3306"),
|
69
69
|
:socket => opts.fetch("socket", nil),
|
70
70
|
:dbname => opts.fetch("dbname", ""),
|
@@ -4,13 +4,16 @@ module JekyllImport
|
|
4
4
|
module Importers
|
5
5
|
class RSS < Importer
|
6
6
|
def self.specify_options(c)
|
7
|
-
c.option "source",
|
8
|
-
c.option "tag",
|
9
|
-
c.option "
|
7
|
+
c.option "source", "--source NAME", "The RSS file or URL to import."
|
8
|
+
c.option "tag", "--tag NAME", "Add a specific tag to all posts."
|
9
|
+
c.option "extract_tags", "--extract_tags KEY", "Copies tags from the given subfield on the RSS `<item>` to front matter. (default: null)"
|
10
|
+
c.option "render_audio", "--render_audio", "Render `<audio>` element in posts for the enclosure URLs. (default: false)"
|
11
|
+
c.option "canonical_link", "--canonical_link", "Add original link as `canonical_url` to post front matter. (default: false)"
|
10
12
|
end
|
11
13
|
|
12
14
|
def self.validate(options)
|
13
15
|
abort "Missing mandatory option --source." if options["source"].nil?
|
16
|
+
abort "Provide either --tag or --extract_tags option." if options["extract_tags"] && options["tag"]
|
14
17
|
end
|
15
18
|
|
16
19
|
def self.require_deps
|
@@ -33,7 +36,7 @@ module JekyllImport
|
|
33
36
|
source = options.fetch("source")
|
34
37
|
|
35
38
|
content = ""
|
36
|
-
open(source) { |s| content = s.read }
|
39
|
+
URI.open(source) { |s| content = s.read }
|
37
40
|
rss = ::RSS::Parser.parse(content, false)
|
38
41
|
|
39
42
|
raise "There doesn't appear to be any RSS items at the source (#{source}) provided." unless rss
|
@@ -52,13 +55,14 @@ module JekyllImport
|
|
52
55
|
post_name = Jekyll::Utils.slugify(item.title, :mode => "latin")
|
53
56
|
name = "#{formatted_date}-#{post_name}"
|
54
57
|
audio = render_audio && item.enclosure.url
|
58
|
+
canonical_link = options.fetch("canonical_link", false)
|
55
59
|
|
56
60
|
header = {
|
57
|
-
"layout"
|
58
|
-
"title"
|
59
|
-
|
60
|
-
|
61
|
-
|
61
|
+
"layout" => "post",
|
62
|
+
"title" => item.title,
|
63
|
+
"canonical_url" => (canonical_link ? item.link : nil),
|
64
|
+
"tag" => get_tags(item, options),
|
65
|
+
}.compact
|
62
66
|
|
63
67
|
frontmatter.each do |value|
|
64
68
|
header[value] = item.send(value)
|
@@ -91,6 +95,21 @@ module JekyllImport
|
|
91
95
|
f.puts output
|
92
96
|
end
|
93
97
|
end
|
98
|
+
|
99
|
+
def self.get_tags(item, options)
|
100
|
+
explicit_tag = options["tag"]
|
101
|
+
return explicit_tag unless explicit_tag.nil? || explicit_tag.empty?
|
102
|
+
|
103
|
+
tags_reference = options["extract_tags"]
|
104
|
+
return unless tags_reference
|
105
|
+
|
106
|
+
tags_from_feed = item.instance_variable_get("@#{tags_reference}")
|
107
|
+
return unless tags_from_feed.is_a?(Array)
|
108
|
+
|
109
|
+
tags = tags_from_feed.map { |feed_tag| feed_tag.content.downcase }
|
110
|
+
tags.empty? ? nil : tags.tap(&:uniq!)
|
111
|
+
end
|
112
|
+
private_class_method :get_tags
|
94
113
|
end
|
95
114
|
end
|
96
115
|
end
|
@@ -17,25 +17,25 @@ module JekyllImport
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.specify_options(c)
|
20
|
-
c.option "dbname", "--dbname DB", "Database name (default: '')"
|
21
|
-
c.option "socket", "--socket SOCKET", "Database socket (default: '')"
|
22
|
-
c.option "user", "--user USER", "Database user name (default: '')"
|
23
|
-
c.option "password", "--password PW", "Database user's password (default: '')"
|
24
|
-
c.option "host", "--host HOST", "Database host name (default: 'localhost')"
|
25
|
-
c.option "port", "--port PORT", "Custom database port connect to (default: 3306)"
|
26
|
-
c.option "table_prefix", "--table_prefix PREFIX", "Table prefix name (default: 'serendipity_')"
|
27
|
-
c.option "clean_entities", "--clean_entities", "Whether to clean entities (default: true)"
|
28
|
-
c.option "comments", "--comments", "Whether to import comments (default: true)"
|
29
|
-
c.option "categories", "--categories", "Whether to import categories (default: true)"
|
30
|
-
c.option "tags", "--tags", "Whether to import tags (default: true)"
|
31
|
-
c.option "drafts", "--drafts", "Whether to export drafts as well"
|
32
|
-
c.option "markdown", "--markdown", "convert into markdown format (default: false)"
|
33
|
-
c.option "permalinks", "--permalinks", "preserve S9Y permalinks (default: false)"
|
34
|
-
c.option "excerpt_separator", "--excerpt_separator", "Demarkation for excerpts (default: '<a id=\"extended\"></a>')"
|
35
|
-
c.option "includeentry", "--includeentry", "Replace macros from the includeentry plugin (default: false)"
|
36
|
-
c.option "imgfig", "--imgfig", "Replace nested img and youtube divs with HTML figure tags (default: true)"
|
37
|
-
c.option "linebreak", "--linebreak", "Line break processing: wp, nokogiri, ignore (default: wp)"
|
38
|
-
c.option "relative", "--relative", "Convert links with this prefix to relative (default:nil)"
|
20
|
+
c.option "dbname", "--dbname DB", "Database name. (default: '')"
|
21
|
+
c.option "socket", "--socket SOCKET", "Database socket. (default: '')"
|
22
|
+
c.option "user", "--user USER", "Database user name. (default: '')"
|
23
|
+
c.option "password", "--password PW", "Database user's password. (default: '')"
|
24
|
+
c.option "host", "--host HOST", "Database host name. (default: 'localhost')"
|
25
|
+
c.option "port", "--port PORT", "Custom database port connect to. (default: 3306)"
|
26
|
+
c.option "table_prefix", "--table_prefix PREFIX", "Table prefix name. (default: 'serendipity_')"
|
27
|
+
c.option "clean_entities", "--clean_entities", "Whether to clean entities. (default: true)"
|
28
|
+
c.option "comments", "--comments", "Whether to import comments. (default: true)"
|
29
|
+
c.option "categories", "--categories", "Whether to import categories. (default: true)"
|
30
|
+
c.option "tags", "--tags", "Whether to import tags. (default: true)"
|
31
|
+
c.option "drafts", "--drafts", "Whether to export drafts as well. (default: true)"
|
32
|
+
c.option "markdown", "--markdown", "convert into markdown format. (default: false)"
|
33
|
+
c.option "permalinks", "--permalinks", "preserve S9Y permalinks. (default: false)"
|
34
|
+
c.option "excerpt_separator", "--excerpt_separator", "Demarkation for excerpts. (default: '<a id=\"extended\"></a>')"
|
35
|
+
c.option "includeentry", "--includeentry", "Replace macros from the includeentry plugin. (default: false)"
|
36
|
+
c.option "imgfig", "--imgfig", "Replace nested img and youtube divs with HTML figure tags. (default: true)"
|
37
|
+
c.option "linebreak", "--linebreak", "Line break processing: wp, nokogiri, ignore. (default: wp)"
|
38
|
+
c.option "relative", "--relative", "Convert links with this prefix to relative. (default: nil)"
|
39
39
|
end
|
40
40
|
|
41
41
|
# Main migrator function. Call this to perform the migration.
|
@@ -99,7 +99,7 @@ module JekyllImport
|
|
99
99
|
options = {
|
100
100
|
:user => opts.fetch("user", ""),
|
101
101
|
:pass => opts.fetch("password", ""),
|
102
|
-
:host => opts.fetch("host", "
|
102
|
+
:host => opts.fetch("host", "127.0.0.1"),
|
103
103
|
:port => opts.fetch("port", 3306),
|
104
104
|
:socket => opts.fetch("socket", nil),
|
105
105
|
:dbname => opts.fetch("dbname", ""),
|
@@ -27,17 +27,17 @@ module JekyllImport
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.specify_options(c)
|
30
|
-
c.option "dbname", "--dbname DB", "Database name"
|
31
|
-
c.option "user", "--user USER", "Database user name"
|
32
|
-
c.option "password", "--password PW", "Database user's password"
|
33
|
-
c.option "host", "--host HOST",
|
30
|
+
c.option "dbname", "--dbname DB", "Database name."
|
31
|
+
c.option "user", "--user USER", "Database user name."
|
32
|
+
c.option "password", "--password PW", "Database user's password. (default: '')"
|
33
|
+
c.option "host", "--host HOST", "Database host name. (default: 'localhost')"
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.process(options)
|
37
37
|
dbname = options.fetch("dbname")
|
38
38
|
user = options.fetch("user")
|
39
39
|
pass = options.fetch("password", "")
|
40
|
-
host = options.fetch("host", "
|
40
|
+
host = options.fetch("host", "127.0.0.1")
|
41
41
|
|
42
42
|
db = Sequel.mysql2(dbname, :user => user, :password => pass, :host => host, :encoding => "utf8")
|
43
43
|
|
@@ -19,11 +19,11 @@ module JekyllImport
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def specify_options(c)
|
22
|
-
c.option "url", "--url URL", "Tumblr URL"
|
23
|
-
c.option "format", "--format FORMAT",
|
24
|
-
c.option "grab_images", "--grab_images", "Whether to grab images (default: false)"
|
25
|
-
c.option "add_highlights", "--add_highlights", "Whether to add highlights (default: false)"
|
26
|
-
c.option "rewrite_urls", "--rewrite_urls", "Whether to rewrite URLs (default: false)"
|
22
|
+
c.option "url", "--url URL", "Tumblr URL."
|
23
|
+
c.option "format", "--format FORMAT", "Output format. (default: 'html')"
|
24
|
+
c.option "grab_images", "--grab_images", "Whether to grab images. (default: false)"
|
25
|
+
c.option "add_highlights", "--add_highlights", "Whether to add highlights. (default: false)"
|
26
|
+
c.option "rewrite_urls", "--rewrite_urls", "Whether to rewrite URLs. (default: false)"
|
27
27
|
end
|
28
28
|
|
29
29
|
def process(options)
|
@@ -31,11 +31,11 @@ module JekyllImport
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.specify_options(c)
|
34
|
-
c.option "server", "--server TYPE",
|
35
|
-
c.option "dbname", "--dbname DB", "Database name"
|
36
|
-
c.option "user", "--user USER", "Database user name"
|
37
|
-
c.option "password", "--password PW", "Database user's password (default: '')"
|
38
|
-
c.option "host", "--host HOST", "Database host name"
|
34
|
+
c.option "server", "--server TYPE", "Server type ('mysql' or 'postgres')."
|
35
|
+
c.option "dbname", "--dbname DB", "Database name."
|
36
|
+
c.option "user", "--user USER", "Database user name."
|
37
|
+
c.option "password", "--password PW", "Database user's password. (default: '')"
|
38
|
+
c.option "host", "--host HOST", "Database host name. (default: 'localhost')"
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.process(options)
|
@@ -43,7 +43,7 @@ module JekyllImport
|
|
43
43
|
dbname = options.fetch("dbname")
|
44
44
|
user = options.fetch("user")
|
45
45
|
pass = options.fetch("password", "")
|
46
|
-
host = options.fetch("host", "
|
46
|
+
host = options.fetch("host", "127.0.0.1")
|
47
47
|
|
48
48
|
FileUtils.mkdir_p "_posts"
|
49
49
|
case server.intern
|
@@ -14,23 +14,23 @@ module JekyllImport
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.specify_options(c)
|
17
|
-
c.option "dbname", "--dbname DB", "Database name (default: '')"
|
18
|
-
c.option "socket", "--socket SOCKET", "Database socket (default: '')"
|
19
|
-
c.option "user", "--user USER", "Database user name (default: '')"
|
20
|
-
c.option "password", "--password PW", "Database user's password (default: '')"
|
21
|
-
c.option "host", "--host HOST", "Database host name (default: 'localhost')"
|
22
|
-
c.option "port", "--port PORT", "Database port number (default: '')"
|
23
|
-
c.option "table_prefix", "--table_prefix PREFIX", "Table prefix name (default: 'wp_')"
|
24
|
-
c.option "site_prefix", "--site_prefix PREFIX", "Site prefix name (default: '')"
|
25
|
-
c.option "clean_entities", "--clean_entities", "Whether to clean entities (default: true)"
|
26
|
-
c.option "comments", "--comments", "Whether to import comments (default: true)"
|
27
|
-
c.option "categories", "--categories", "Whether to import categories (default: true)"
|
28
|
-
c.option "tags", "--tags", "Whether to import tags (default: true)"
|
29
|
-
c.option "more_excerpt", "--more_excerpt", "Whether to use more excerpt (default: true)"
|
30
|
-
c.option "more_anchor", "--more_anchor", "Whether to use more anchor (default: true)"
|
17
|
+
c.option "dbname", "--dbname DB", "Database name. (default: '')"
|
18
|
+
c.option "socket", "--socket SOCKET", "Database socket. (default: '')"
|
19
|
+
c.option "user", "--user USER", "Database user name. (default: '')"
|
20
|
+
c.option "password", "--password PW", "Database user's password. (default: '')"
|
21
|
+
c.option "host", "--host HOST", "Database host name. (default: 'localhost')"
|
22
|
+
c.option "port", "--port PORT", "Database port number. (default: '')"
|
23
|
+
c.option "table_prefix", "--table_prefix PREFIX", "Table prefix name. (default: 'wp_')"
|
24
|
+
c.option "site_prefix", "--site_prefix PREFIX", "Site prefix name. (default: '')"
|
25
|
+
c.option "clean_entities", "--clean_entities", "Whether to clean entities. (default: true)"
|
26
|
+
c.option "comments", "--comments", "Whether to import comments. (default: true)"
|
27
|
+
c.option "categories", "--categories", "Whether to import categories. (default: true)"
|
28
|
+
c.option "tags", "--tags", "Whether to import tags. (default: true)"
|
29
|
+
c.option "more_excerpt", "--more_excerpt", "Whether to use more excerpt. (default: true)"
|
30
|
+
c.option "more_anchor", "--more_anchor", "Whether to use more anchor. (default: true)"
|
31
31
|
|
32
32
|
c.option "status", "--status STATUS,STATUS2", Array,
|
33
|
-
"Array of allowed statuses (
|
33
|
+
"Array of allowed statuses ('publish', 'draft', 'private', 'revision'). (default: ['publish'])"
|
34
34
|
end
|
35
35
|
|
36
36
|
# Main migrator function. Call this to perform the migration.
|
@@ -81,7 +81,7 @@ module JekyllImport
|
|
81
81
|
options = {
|
82
82
|
:user => opts.fetch("user", ""),
|
83
83
|
:pass => opts.fetch("password", ""),
|
84
|
-
:host => opts.fetch("host", "
|
84
|
+
:host => opts.fetch("host", "127.0.0.1"),
|
85
85
|
:port => opts.fetch("port", "3306"),
|
86
86
|
:socket => opts.fetch("socket", nil),
|
87
87
|
:dbname => opts.fetch("dbname", ""),
|
@@ -16,9 +16,9 @@ module JekyllImport
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.specify_options(c)
|
19
|
-
c.option "source", "--source FILE",
|
20
|
-
c.option "no_fetch_images", "--no-fetch-images", "Do not fetch the images referenced in the posts"
|
21
|
-
c.option "assets_folder", "--assets_folder FOLDER", "Folder where assets such as images will be downloaded to (default: assets)"
|
19
|
+
c.option "source", "--source FILE", "WordPress export XML file (default: 'wordpress.xml')"
|
20
|
+
c.option "no_fetch_images", "--no-fetch-images", "Do not fetch the images referenced in the posts (default: false)"
|
21
|
+
c.option "assets_folder", "--assets_folder FOLDER", "Folder where assets such as images will be downloaded to (default: 'assets')"
|
22
22
|
end
|
23
23
|
|
24
24
|
# Will modify post DOM tree
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Preston-Werner
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-03-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jekyll
|
@@ -52,14 +52,14 @@ dependencies:
|
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '1
|
55
|
+
version: '2.1'
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
58
|
version_requirements: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '1
|
62
|
+
version: '2.1'
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: bundler
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,14 +80,14 @@ dependencies:
|
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '13.0'
|
84
84
|
type: :development
|
85
85
|
prerelease: false
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '
|
90
|
+
version: '13.0'
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rdoc
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,14 +122,14 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: '1
|
125
|
+
version: '3.1'
|
126
126
|
type: :development
|
127
127
|
prerelease: false
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: '1
|
132
|
+
version: '3.1'
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: rubocop-jekyll
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,14 +150,14 @@ dependencies:
|
|
150
150
|
requirements:
|
151
151
|
- - "~>"
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version: '
|
153
|
+
version: '4.0'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
156
|
version_requirements: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
158
|
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version: '
|
160
|
+
version: '4.0'
|
161
161
|
- !ruby/object:Gem::Dependency
|
162
162
|
name: simplecov
|
163
163
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,20 +186,6 @@ dependencies:
|
|
186
186
|
- - "~>"
|
187
187
|
- !ruby/object:Gem::Version
|
188
188
|
version: '1.0'
|
189
|
-
- !ruby/object:Gem::Dependency
|
190
|
-
name: behance
|
191
|
-
requirement: !ruby/object:Gem::Requirement
|
192
|
-
requirements:
|
193
|
-
- - "~>"
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
version: '0.3'
|
196
|
-
type: :development
|
197
|
-
prerelease: false
|
198
|
-
version_requirements: !ruby/object:Gem::Requirement
|
199
|
-
requirements:
|
200
|
-
- - "~>"
|
201
|
-
- !ruby/object:Gem::Version
|
202
|
-
version: '0.3'
|
203
189
|
- !ruby/object:Gem::Dependency
|
204
190
|
name: hpricot
|
205
191
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,28 +248,42 @@ dependencies:
|
|
262
248
|
requirements:
|
263
249
|
- - "~>"
|
264
250
|
- !ruby/object:Gem::Version
|
265
|
-
version: '0
|
251
|
+
version: '1.0'
|
252
|
+
type: :development
|
253
|
+
prerelease: false
|
254
|
+
version_requirements: !ruby/object:Gem::Requirement
|
255
|
+
requirements:
|
256
|
+
- - "~>"
|
257
|
+
- !ruby/object:Gem::Version
|
258
|
+
version: '1.0'
|
259
|
+
- !ruby/object:Gem::Dependency
|
260
|
+
name: rss
|
261
|
+
requirement: !ruby/object:Gem::Requirement
|
262
|
+
requirements:
|
263
|
+
- - "~>"
|
264
|
+
- !ruby/object:Gem::Version
|
265
|
+
version: '0.2'
|
266
266
|
type: :development
|
267
267
|
prerelease: false
|
268
268
|
version_requirements: !ruby/object:Gem::Requirement
|
269
269
|
requirements:
|
270
270
|
- - "~>"
|
271
271
|
- !ruby/object:Gem::Version
|
272
|
-
version: '0.
|
272
|
+
version: '0.2'
|
273
273
|
- !ruby/object:Gem::Dependency
|
274
274
|
name: sequel
|
275
275
|
requirement: !ruby/object:Gem::Requirement
|
276
276
|
requirements:
|
277
277
|
- - "~>"
|
278
278
|
- !ruby/object:Gem::Version
|
279
|
-
version: '
|
279
|
+
version: '5.62'
|
280
280
|
type: :development
|
281
281
|
prerelease: false
|
282
282
|
version_requirements: !ruby/object:Gem::Requirement
|
283
283
|
requirements:
|
284
284
|
- - "~>"
|
285
285
|
- !ruby/object:Gem::Version
|
286
|
-
version: '
|
286
|
+
version: '5.62'
|
287
287
|
- !ruby/object:Gem::Dependency
|
288
288
|
name: sqlite3
|
289
289
|
requirement: !ruby/object:Gem::Requirement
|
@@ -355,6 +355,7 @@ files:
|
|
355
355
|
- lib/jekyll-import/importers/joomla3.rb
|
356
356
|
- lib/jekyll-import/importers/jrnl.rb
|
357
357
|
- lib/jekyll-import/importers/marley.rb
|
358
|
+
- lib/jekyll-import/importers/medium.rb
|
358
359
|
- lib/jekyll-import/importers/mephisto.rb
|
359
360
|
- lib/jekyll-import/importers/mt.rb
|
360
361
|
- lib/jekyll-import/importers/pluxml.rb
|