jekyll-import 0.6.0 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc7406feefb90f863da53e19f16b1332df9cc517
4
- data.tar.gz: d489c2861991abd91d233bfd453893240ddb0764
3
+ metadata.gz: 201c546213ef922eaefabb7fd0d2a3120c39ff58
4
+ data.tar.gz: 9fbe1cf648f0ba24829b5288e4ae61e738864e5e
5
5
  SHA512:
6
- metadata.gz: 344444bad905756c1048ac045cc867024837dc9aa48e88062838cb09cb61641969326fa9e6df1e5e8a36d8a068d58acb012dde471a8b5cedce07988d8d02da13
7
- data.tar.gz: bb57faf4b37239f021ab7b0e6578457896c8fbed3d5bf5f53540b4976f27d60bc017d6aca002fbf7195dba821bd3053ff5b0b9f04ce8046f884fd7a56d3fb08c
6
+ metadata.gz: abaa5f3f91064400b2d2de1ee13be2b21ac6e6eb9b5c948aa8aff8ce3eccd85449a8e19b2c06f9ee72ffb352f5c1cf30848cdd9893350f2c89692539fc655e0c
7
+ data.tar.gz: c93f9b168fcc34f6bef5bf1bb41c3cde973c98ed7a7ed83433b7179410c76b2aaa8a1e02a3f2ff4f8a6c042f9685562a33986e51c742c95390433100bc5278c1
@@ -73,7 +73,7 @@ module JekyllImport
73
73
  # to YAML for the header
74
74
  data = {
75
75
  'layout' => 'post',
76
- 'title' => title.to_s,
76
+ 'title' => title.strip.force_encoding("UTF-8"),
77
77
  'created' => created,
78
78
  'excerpt' => summary
79
79
  }.delete_if { |k,v| v.nil? || v == ''}.to_yaml
@@ -72,7 +72,12 @@ module JekyllImport
72
72
  if content
73
73
  if use_markdown
74
74
  content = html_to_markdown content
75
- content = add_syntax_highlights content if add_highlights
75
+ if add_highlights
76
+ tumblr_url = URI.parse(post[:slug]).path
77
+ redirect_dir = tumblr_url.sub(/\//, "") + "/"
78
+ FileUtils.mkdir_p redirect_dir
79
+ content = add_syntax_highlights(content, redirect_dir)
80
+ end
76
81
  end
77
82
 
78
83
  File.open("_posts/tumblr/#{post[:name]}", "w") do |f|
@@ -132,7 +137,11 @@ module JekyllImport
132
137
  title = post["video-title"]
133
138
  content = post["video-player"]
134
139
  unless post["video-caption"].nil?
135
- content << "<br/>" + post["video-caption"]
140
+ unless content.nil?
141
+ content << "<br/>" + post["video-caption"]
142
+ else
143
+ content = post["video-caption"]
144
+ end
136
145
  end
137
146
  when "answer"
138
147
  title = post["question"]
@@ -236,7 +245,7 @@ module JekyllImport
236
245
  # For example, my code block only contain Python and JavaScript,
237
246
  # so I can assume the block is JavaScript if it contains a
238
247
  # semi-colon.
239
- def self.add_syntax_highlights(content)
248
+ def self.add_syntax_highlights(content, redirect_dir)
240
249
  lines = content.split("\n")
241
250
  block, indent, lang, start = false, /^ /, nil, nil
242
251
  lines.each_with_index do |line, i|
@@ -1,3 +1,3 @@
1
1
  module JekyllImport
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
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.6.0
4
+ version: 0.7.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: 2015-03-07 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll