Bash batch script to convert org-mode file to html

I recently read this on reddit. I adapted the script on there to convert multiple org-mode files to html files. If you use it make sure you adapte the location of org-mode and your org.el file. Enjoy.

 <pre class="src src-sh"><span style="color: #ff4500;">#</span><span style="color: #ff4500;">! /bin/</span><span style="color: #00ffff;">bash</span>

## http://www.reddit.com/r/emacs/comments/dy9yt/anyone_know_of_a_script_that_i_can_feed_an/ ## http://www.ibm.com/developerworks/library/l-bash2.html ## http://desk.stinkpot.org:8080/tricks/index.php/2007/02/concatenate-strings-in-bash/ f=“” for file in “$@” do ##emacs –batch -q –no-site-file –eval “(add-to-list ‘load-path “~/.emacs.d/org-mode/lisp/”)” –load $HOME/.emacs.d/org-mode/lisp/org.el –visit ${file} –funcall org-export-as-html-batch f=“${f} –visit ${file} –funcall org-export-as-html-batch” done emacs –batch -q –no-site-file –eval “(add-to-list ‘load-path “~/.emacs.d/org-mode/lisp/“)” –load $HOME/.emacs.d/org-mode/lisp/org.el $f ## use emacsclient, check if running, execute. otherwise u this ## NO, emacsclient takes in elisp argument with –eval, not list list of files (will need to write my own elisp function…not worth effort)

About Vinh Nguyen

Statistician

3 comments

  1. Pingback: bamanzi
  2. That’s exactly what I needed. Many thanks for sharing!

    It went into my makefile, though as pdf creation instead of html:

    doktorarbeit.pdf : doktorarbeit.tex doktorarbeit.org emacs --batch --visit "doktorarbeit.org" --funcall org-export-as-pdf

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>