Skip to content

Instantly share code, notes, and snippets.

@tgdnt
Last active February 23, 2019 23:11
Script to convert Org files into HTML for a Jekyll site
git clean -df
mkdir _posts _drafts
find ./_orgsource -name "*.org" | while read -r filename; do
sed -e 's/\(\#\+BEGIN\_SRC \)\(.*\)/\#\+BEGIN_HTML\
{\% highlight \2 \%}/' -e 's/\#\+END\_SRC/{\% endhighlight \%}\
\#\+END_HTML/' $filename > $filename.temp.org
newfilename=$(echo $filename | sed -e "s/\(\.\/\)\(\_orgsource\/\)\(.*\)\(.org\)/\1\3\.html/g")
pandoc -t html -o $newfilename $filename.temp.org
rm $filename.temp.org
done
cp ./_orgsource/images/* ./assets/images/
bundle exec jekyll $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment