Created
February 24, 2013 09:28
-
-
Save satooshi/5023226 to your computer and use it in GitHub Desktop.
Convert tumblr blog html to markdown (pandoc required). See gist 5023141.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cmd_pandoc="pandoc -f html -t markdown body.html -o body.md" | |
posts=`ls _posts` | |
root_dir=`pwd` | |
for post in ${posts} | |
do | |
post_dir="_posts/${post}" | |
echo ${post_dir} | |
# html 2 markdown | |
cd ${post_dir} | |
${cmd_pandoc} | |
rm body.html | |
markdown=`ls *.markdown` | |
for md in ${markdown} | |
do | |
echo "" >> ${md} | |
cat body.md >> ${md} | |
rm body.md | |
done | |
# done post | |
cd ${root_dir} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment