#!/bin/sh

# assumes ./org directory with org files to publish to 
# ./html

target=$(readlink -f $1)

dir=`pwd`

emacsclient \
--eval "
(progn
(setq org-publish-project-alist
      '(
	(\"project\"
	 :base-directory \"$dir/org\"
	 :base-extension \"org\"
	 :publishing-directory \"$dir/html\"
	 :recursive t
	 :publishing-function org-publish-org-to-html
	 :auto-preamble t)
	))

(org-publish-file \"$target\" '(\"project\"
	 :base-directory \"$dir/org\"
	 :base-extension \"org\"
	 :publishing-directory \"$dir/html\"
	 :recursive t
	 :publishing-function org-publish-org-to-html
	 :auto-preamble t)
	))" \
\
2>&1 #| pcregrep 'Wrote'







