jekyll-import 0.20.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.
@@ -11,25 +11,31 @@ module JekyllImport
11
11
  fileutils
12
12
  safe_yaml
13
13
  unidecode
14
+ nokogiri
14
15
  )
15
16
  )
16
17
  end
17
18
 
18
19
  def self.specify_options(c)
19
- c.option "dbname", "--dbname DB", "Database name (default: '')"
20
- c.option "socket", "--socket SOCKET", "Database socket (default: '')"
21
- c.option "user", "--user USER", "Database user name (default: '')"
22
- c.option "password", "--password PW", "Database user's password (default: '')"
23
- c.option "host", "--host HOST", "Database host name (default: 'localhost')"
24
- c.option "port", "--port PORT", "Custom database port connect to (default: 3306)"
25
- c.option "table_prefix", "--table_prefix PREFIX", "Table prefix name (default: 'serendipity_')"
26
- c.option "clean_entities", "--clean_entities", "Whether to clean entities (default: true)"
27
- c.option "comments", "--comments", "Whether to import comments (default: true)"
28
- c.option "categories", "--categories", "Whether to import categories (default: true)"
29
- c.option "tags", "--tags", "Whether to import tags (default: true)"
30
- c.option "drafts", "--drafts", "Whether to export drafts as well"
31
- c.option "markdown", "--markdown", "convert into markdown format (default: false)"
32
- c.option "permalinks", "--permalinks", "preserve S9Y permalinks (default: false)"
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)"
33
39
  end
34
40
 
35
41
  # Main migrator function. Call this to perform the migration.
@@ -56,36 +62,64 @@ module JekyllImport
56
62
  # :categories:: If true, save the post's categories in its
57
63
  # YAML front matter. Default: true.
58
64
  # :tags:: If true, save the post's tags in its
59
- # YAML front matter. Default: true.
65
+ # YAML front matter, in lowercase. Default: true.
60
66
  # :extension:: Set the post extension. Default: "html"
61
67
  # :drafts:: If true, export drafts as well
62
68
  # Default: true.
63
69
  # :markdown:: If true, convert the content to markdown
64
70
  # Default: false
65
71
  # :permalinks:: If true, save the post's original permalink in its
66
- # YAML front matter. Default: false.
72
+ # YAML front matter. If the 'entryproperties' plugin
73
+ # was used, its permalink will become the canonical
74
+ # permalink, and any other will become redirects.
75
+ # Default: false.
76
+ # :excerpt_separator:: A string to use to separate the excerpt (body
77
+ # in S9Y) from the rest of the article (extended
78
+ # body in S9Y). Default: "<a id=\"extended\"></a>".
79
+ # :includentry:: Replace macros from the includentry plugin - these are
80
+ # the [s9y-include-entry] and [s9y-include-block] macros.
81
+ # Default: false.
82
+ # :imgfig:: Replace S9Y image-comment divs with an HTML figure
83
+ # div and figcaption, if applicable. Works for img and
84
+ # iframe.
85
+ # Default: true.
67
86
  #
87
+ # :linebreak:: When set to the default "wp", line breaks in entries
88
+ # will be processed WordPress style, by replacing double
89
+ # line breaks with HTML p tags, and remaining single
90
+ # line breaks with HTML br tags. When set to "nokogiri",
91
+ # entries will be loaded into Nokogiri and formatted as
92
+ # an XHTML fragment. When set to "ignore", line breaks
93
+ # will not be replaced at all.
94
+ # Default: wp
95
+ # :relative:: Replace absolute links (http://:relative:/foo)
96
+ # to relative links (/foo).
97
+
68
98
  def self.process(opts)
69
99
  options = {
70
- :user => opts.fetch("user", ""),
71
- :pass => opts.fetch("password", ""),
72
- :host => opts.fetch("host", "localhost"),
73
- :port => opts.fetch("port", 3306),
74
- :socket => opts.fetch("socket", nil),
75
- :dbname => opts.fetch("dbname", ""),
76
- :table_prefix => opts.fetch("table_prefix", "serendipity_"),
77
- :clean_entities => opts.fetch("clean_entities", true),
78
- :comments => opts.fetch("comments", true),
79
- :categories => opts.fetch("categories", true),
80
- :tags => opts.fetch("tags", true),
81
- :extension => opts.fetch("extension", "html"),
82
- :drafts => opts.fetch("drafts", true),
83
- :markdown => opts.fetch("markdown", false),
84
- :permalinks => opts.fetch("permalinks", false),
100
+ :user => opts.fetch("user", ""),
101
+ :pass => opts.fetch("password", ""),
102
+ :host => opts.fetch("host", "127.0.0.1"),
103
+ :port => opts.fetch("port", 3306),
104
+ :socket => opts.fetch("socket", nil),
105
+ :dbname => opts.fetch("dbname", ""),
106
+ :table_prefix => opts.fetch("table_prefix", "serendipity_"),
107
+ :clean_entities => opts.fetch("clean_entities", true),
108
+ :comments => opts.fetch("comments", true),
109
+ :categories => opts.fetch("categories", true),
110
+ :tags => opts.fetch("tags", true),
111
+ :extension => opts.fetch("extension", "html"),
112
+ :drafts => opts.fetch("drafts", true),
113
+ :markdown => opts.fetch("markdown", false),
114
+ :permalinks => opts.fetch("permalinks", false),
115
+ :excerpt_separator => opts.fetch("excerpt_separator", "<a id=\"extended\"></a>"),
116
+ :includeentry => opts.fetch("includeentry", false),
117
+ :imgfig => opts.fetch("imgfig", true),
118
+ :linebreak => opts.fetch("linebreak", "wp"),
119
+ :relative => opts.fetch("relative", nil),
85
120
  }
86
121
 
87
122
  options[:clean_entities] = require_if_available("htmlentities", "clean_entities") if options[:clean_entities]
88
-
89
123
  options[:markdown] = require_if_available("reverse_markdown", "markdown") if options[:markdown]
90
124
 
91
125
  FileUtils.mkdir_p("_posts")
@@ -120,6 +154,7 @@ module JekyllImport
120
154
 
121
155
  posts_query = "
122
156
  SELECT
157
+ 'post' AS `type`,
123
158
  entries.ID AS `id`,
124
159
  entries.isdraft AS `isdraft`,
125
160
  entries.title AS `title`,
@@ -154,36 +189,41 @@ module JekyllImport
154
189
  name = format("%02d-%02d-%02d-%s.%s", date.year, date.month, date.day, slug, extension)
155
190
 
156
191
  content = post[:body].to_s
157
- content += "\n\n" + post[:body_extended].to_s unless post[:body_extended].to_s.empty?
192
+ extended_content = post[:body_extended].to_s
193
+
194
+ content += options[:excerpt_separator] + extended_content unless extended_content.nil? || extended_content.strip.empty?
158
195
 
196
+ content = process_includeentry(content, db, options) if options[:includeentry]
197
+ content = process_img_div(content) if options[:imgfig]
159
198
  content = clean_entities(content) if options[:clean_entities]
199
+ content = content.gsub(%r!href=(["'])http://#{options[:relative]}!, 'href=\1') if options[:relative]
160
200
 
161
201
  content = ReverseMarkdown.convert(content) if options[:markdown]
162
202
 
163
203
  categories = process_categories(db, options, post)
164
204
  comments = process_comments(db, options, post)
165
205
  tags = process_tags(db, options, post)
166
- permalink = process_permalink(db, options, post)
206
+ all_permalinks = process_permalink(db, options, post)
207
+ primary_permalink = all_permalinks.shift
208
+ supplemental_permalinks = all_permalinks unless all_permalinks.empty?
167
209
 
168
210
  # Get the relevant fields as a hash, delete empty fields and
169
211
  # convert to YAML for the header.
170
212
  data = {
171
- "layout" => post[:type].to_s,
172
- "status" => status.to_s,
173
- "published" => status.to_s == "draft" ? nil : (status.to_s == "published"),
174
- "title" => title.to_s,
175
- "author" => {
176
- "display_name" => post[:author].to_s,
177
- "login" => post[:author_login].to_s,
178
- "email" => post[:author_email].to_s,
179
- },
180
- "author_login" => post[:author_login].to_s,
181
- "author_email" => post[:author_email].to_s,
182
- "date" => date.to_s,
183
- "permalink" => options[:permalinks] ? permalink : nil,
184
- "categories" => options[:categories] ? categories : nil,
185
- "tags" => options[:tags] ? tags : nil,
186
- "comments" => options[:comments] ? comments : nil,
213
+ "layout" => post[:type].to_s,
214
+ "status" => status.to_s,
215
+ "published" => status.to_s == "draft" ? nil : (status.to_s == "published"),
216
+ "title" => title.to_s,
217
+ "author" => post[:author].to_s,
218
+ "author_login" => post[:author_login].to_s,
219
+ "author_email" => post[:author_email].to_s,
220
+ "date" => date.to_s,
221
+ "permalink" => options[:permalinks] ? primary_permalink : nil,
222
+ "redirect_from" => options[:permalinks] ? supplemental_permalinks : nil,
223
+ "categories" => options[:categories] ? categories : nil,
224
+ "tags" => options[:tags] ? tags : nil,
225
+ "comments" => options[:comments] ? comments : nil,
226
+ "excerpt_separator" => extended_content.empty? ? nil : options[:excerpt_separator],
187
227
  }.delete_if { |_k, v| v.nil? || v == "" }.to_yaml
188
228
 
189
229
  if post[:type] == "page"
@@ -195,11 +235,21 @@ module JekyllImport
195
235
  filename = "_posts/#{name}"
196
236
  end
197
237
 
238
+ content = case options[:linebreak]
239
+ when "nokogiri"
240
+ Nokogiri::HTML.fragment(content).to_xhtml
241
+ when "ignore"
242
+ content
243
+ else
244
+ # "wp" is the only remaining option, and the default
245
+ Util.wpautop(content)
246
+ end
247
+
198
248
  # Write out the data and content to file
199
249
  File.open(filename, "w") do |f|
200
250
  f.puts data
201
251
  f.puts "---"
202
- f.puts Util.wpautop(content)
252
+ f.puts content
203
253
  end
204
254
  end
205
255
 
@@ -207,10 +257,154 @@ module JekyllImport
207
257
  require gem_name
208
258
  true
209
259
  rescue LoadError
210
- warn "Could not require '#{gem_name}', so the :#{option_name} option is now disabled."
260
+ Jekyll.logger.warn "s9y database:", "Could not require '#{gem_name}', so the :#{option_name} option is now disabled."
211
261
  true
212
262
  end
213
263
 
264
+ def self.process_includeentry(text, db, options)
265
+ return text unless options[:includeentry]
266
+
267
+ result = text
268
+
269
+ px = options[:table_prefix]
270
+
271
+ props = text.scan(%r!(\[s9y-include-entry:([0-9]+):([^:]+)\])!)
272
+ blocks = text.scan(%r!(\[s9y-include-block:([0-9]+):?([^:]+)?\])!)
273
+
274
+ props.each do |match|
275
+ macro = match[0]
276
+ id = match[1]
277
+ replacement = ""
278
+ if match[2].start_with?("prop=")
279
+ prop = match[2].sub("prop=", "")
280
+ cquery = get_property_query(px, id, prop)
281
+ else
282
+ prop = match[2]
283
+ cquery = get_value_query(px, id, prop)
284
+ end
285
+ db[cquery].each do |row|
286
+ replacement << row[:txt]
287
+ end
288
+ result = result.sub(macro, replacement)
289
+ end
290
+
291
+ blocks.each do |match|
292
+ macro = match[0]
293
+ id = match[1]
294
+ replacement = ""
295
+ # match[2] *could* be 'template', but we can't run it through Smarty, so we ignore it
296
+ cquery = %(
297
+ SELECT
298
+ px.body AS `txt`
299
+ FROM
300
+ #{px}staticblocks AS px
301
+ WHERE
302
+ id = '#{id}'
303
+ )
304
+ db[cquery].each do |row|
305
+ replacement << row[:txt]
306
+ end
307
+ result = result.sub(macro, replacement)
308
+ end
309
+
310
+ result
311
+ end
312
+
313
+ def get_property_query(px, id, prop)
314
+ %(
315
+ SELECT
316
+ px.value AS `txt`
317
+ FROM
318
+ #{px}entryproperties AS px
319
+ WHERE
320
+ entryid = '#{id}' AND
321
+ property = '#{prop}'
322
+ )
323
+ end
324
+
325
+ def get_value_query(px, id, prop)
326
+ %(
327
+ SELECT
328
+ px.#{prop} AS `txt`
329
+ FROM
330
+ #{px}entries AS px
331
+ WHERE
332
+ entryid = '#{id}'
333
+ )
334
+ end
335
+
336
+ # Replace .serendipity_imageComment_* blocks
337
+ def self.process_img_div(text)
338
+ caption_classes = [
339
+ ".serendipity_imageComment_left",
340
+ ".serendipity_imageComment_right",
341
+ ".serendipity_imageComment_center",
342
+ ]
343
+
344
+ noko = Nokogiri::HTML.fragment(text)
345
+ noko.css(caption_classes.join(",")).each do |imgcaption|
346
+ block_attrs = get_block_attrs(imgcaption)
347
+
348
+ # Is this a thumbnail to a bigger/other image?
349
+ big_link = imgcaption.at_css(".serendipity_image_link")
350
+ big_link ||= imgcaption.at_xpath(".//a[.//img]")
351
+
352
+ # The caption (if any) may have raw HTML
353
+ caption_elem = imgcaption.at_css(".serendipity_imageComment_txt")
354
+ caption = ""
355
+ caption = "<figcaption>#{caption_elem.inner_html}</figcaption>" if caption_elem
356
+
357
+ image_node = imgcaption.at_css("img")
358
+ if image_node
359
+ attrs = get_media_attrs(image_node)
360
+ media = "<img #{attrs}/>"
361
+ else
362
+ iframe_node = imgcaption.at_css("iframe")
363
+ if iframe_node
364
+ attrs = get_media_attrs(iframe_node)
365
+ media = "<iframe #{attrs}'></iframe>"
366
+ else
367
+ Jekyll.logger.warn "s9y database:", "Unrecognized media block: #{imgcaption}"
368
+ return text
369
+ end
370
+ end
371
+
372
+ # Wrap media in link, if any
373
+ if big_link
374
+ big = big_link.attribute("href")
375
+ media = "<a href='#{big}'>#{media}</a>"
376
+ end
377
+
378
+ # Replace HTML with clean media source, wrapped in figure
379
+ imgcaption.replace("<figure #{block_attrs}#{media}#{caption}</figure>")
380
+ end
381
+
382
+ noko.to_s
383
+ end
384
+
385
+ def get_media_attrs(node)
386
+ width = node.attribute("width")
387
+ width = "width='#{width}'" if width
388
+ height = node.attribute("height")
389
+ height = "height='#{height}'" if height
390
+ alt = node.attribute("alt")
391
+ alt = "alt='#{alt}'" if alt
392
+ src = "src='" + node.attribute("src") + "'"
393
+ [src, width, height, alt].join(" ")
394
+ end
395
+
396
+ def get_block_attrs(imgcaption)
397
+ # Extract block-level attributes
398
+ float = imgcaption.attribute("class").value.sub("serendipity_imageComment_", "")
399
+ float = "class='figure-#{float}'"
400
+ style = imgcaption.attribute("style")
401
+ style = " style='#{style.value}'" if style
402
+ # Don't lose good data
403
+ mdbnum = imgcaption.search(".//comment()").text.strip.sub("s9ymdb:", "")
404
+ mdb = "<!-- mdb='#{mdbnum}' -->" if mdbnum
405
+ [float, style, mdb].join(" ")
406
+ end
407
+
214
408
  def self.process_categories(db, options, post)
215
409
  return [] unless options[:categories]
216
410
 
@@ -293,18 +487,36 @@ module JekyllImport
293
487
 
294
488
  db[cquery].each_with_object([]) do |tag, tags|
295
489
  tags << if options[:clean_entities]
296
- clean_entities(tag[:name])
490
+ clean_entities(tag[:name]).downcase
297
491
  else
298
- tag[:name]
492
+ tag[:name].downcase
299
493
  end
300
494
  end
301
495
  end
302
496
 
303
497
  def self.process_permalink(db, options, post)
304
- return unless options[:permalinks]
498
+ return [] unless options[:permalinks]
499
+
500
+ permalinks = []
305
501
 
306
502
  px = options[:table_prefix]
307
503
 
504
+ if db.table_exists?("#{px}entryproperties")
505
+ pquery = %(
506
+ SELECT
507
+ props.value AS `permalink`
508
+ FROM
509
+ #{px}entryproperties AS props
510
+ WHERE
511
+ props.entryid = '#{post[:id]}' AND
512
+ props.property = 'permalink'
513
+ )
514
+ db[pquery].each do |link|
515
+ plink = link[:permalink].to_s
516
+ permalinks << plink unless plink.end_with? "/UNKNOWN.html"
517
+ end
518
+ end
519
+
308
520
  cquery = %(
309
521
  SELECT
310
522
  permalinks.permalink AS `permalink`
@@ -316,8 +528,10 @@ module JekyllImport
316
528
  )
317
529
 
318
530
  db[cquery].each do |link|
319
- return "/#{link[:permalink]}"
531
+ permalinks << "/#{link[:permalink]}"
320
532
  end
533
+
534
+ permalinks
321
535
  end
322
536
 
323
537
  def self.clean_entities(text)
@@ -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", 'Database host name (default: "localhost")'
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", "localhost")
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", '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)"
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", '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"
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", "localhost")
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 (default: ['publish'], other options: 'draft', 'private', 'revision')"
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", "localhost"),
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", '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"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllImport
4
- VERSION = "0.20.0"
4
+ VERSION = "0.22.0"
5
5
  end