lib/jekyll-import/importers/tumblr.rb in jekyll-import-0.6.0 vs lib/jekyll-import/importers/tumblr.rb in jekyll-import-0.7.0

- old
+ new

@@ -70,11 +70,16 @@ content = post[:content] if content if use_markdown content = html_to_markdown content - content = add_syntax_highlights content if add_highlights + if add_highlights + tumblr_url = URI.parse(post[:slug]).path + redirect_dir = tumblr_url.sub(/\//, "") + "/" + FileUtils.mkdir_p redirect_dir + content = add_syntax_highlights(content, redirect_dir) + end end File.open("_posts/tumblr/#{post[:name]}", "w") do |f| f.puts post[:header].to_yaml + "---\n" + content end @@ -130,11 +135,15 @@ content << "</section></dialog>" when "video" title = post["video-title"] content = post["video-player"] unless post["video-caption"].nil? - content << "<br/>" + post["video-caption"] + unless content.nil? + content << "<br/>" + post["video-caption"] + else + content = post["video-caption"] + end end when "answer" title = post["question"] content = post["answer"] end @@ -234,10 +243,10 @@ # markdown format. This doesn't guess the language of the code # block, so you should modify this to suit your own content. # For example, my code block only contain Python and JavaScript, # so I can assume the block is JavaScript if it contains a # semi-colon. - def self.add_syntax_highlights(content) + def self.add_syntax_highlights(content, redirect_dir) lines = content.split("\n") block, indent, lang, start = false, /^ /, nil, nil lines.each_with_index do |line, i| if !block && line =~ indent block = true