Add a format option for converting posts to markdown via Python's html2text.
This commit is contained in:
parent
87316894cc
commit
b762a1d5c5
|
@ -8,7 +8,7 @@ require 'date'
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Tumblr
|
module Tumblr
|
||||||
def self.process(url, grab_images = false)
|
def self.process(url, grab_images = false, format = "html")
|
||||||
current_page = 0
|
current_page = 0
|
||||||
|
|
||||||
while true
|
while true
|
||||||
|
@ -75,6 +75,7 @@ module Jekyll
|
||||||
name = "#{Date.parse(post['date']).to_s}-#{title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}.#{format}"
|
name = "#{Date.parse(post['date']).to_s}-#{title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}.#{format}"
|
||||||
|
|
||||||
if title != nil || content != nil && name != nil
|
if title != nil || content != nil && name != nil
|
||||||
|
content = %x[echo '#{content.gsub("'", "''")}' | html2text] if format == "md"
|
||||||
File.open("_posts/tumblr/#{name}", "w") do |f|
|
File.open("_posts/tumblr/#{name}", "w") do |f|
|
||||||
|
|
||||||
f.puts <<-HEADER
|
f.puts <<-HEADER
|
||||||
|
|
Loading…
Reference in New Issue