Add a format option for converting posts to markdown via Python's html2text.

This commit is contained in:
Stephen McDonald 2011-11-20 22:15:36 +11:00
parent 87316894cc
commit b762a1d5c5
1 changed files with 2 additions and 1 deletions

View File

@ -8,7 +8,7 @@ require 'date'
module Jekyll
module Tumblr
def self.process(url, grab_images = false)
def self.process(url, grab_images = false, format = "html")
current_page = 0
while true
@ -75,6 +75,7 @@ module Jekyll
name = "#{Date.parse(post['date']).to_s}-#{title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}.#{format}"
if title != nil || content != nil && name != nil
content = %x[echo '#{content.gsub("'", "''")}' | html2text] if format == "md"
File.open("_posts/tumblr/#{name}", "w") do |f|
f.puts <<-HEADER