Skip to content

Instantly share code, notes, and snippets.

@noamross
Created May 22, 2012 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noamross/2766178 to your computer and use it in GitHub Desktop.
Save noamross/2766178 to your computer and use it in GitHub Desktop.
This is my live preview script for a pandoc file
#!/bin/bash
text=`cat`
echo -E $text | grep -o '@\w*' | sort -n | uniq | sed -n 's/@\(.*\)/\\citation\{\1\}/p' >> ~/smallbib.aux
bibtool --preserve.key.case=on -s -d -x ~/smallbib.aux /Users/noamross/Dropbox/Public/library.bib -o ~/smallbib.bib
echo -E "$text" | pandoc -f markdown -t html --smart --mathjax --bibliography=/Users/noamross/smallbib.bib --csl=/Users/noamross/Dropbox/Public/pd/ecology.csl --template=/Users/noamross/Dropbox/Public/pd/noam.html --base-header-level=2
rm ~/smallbib.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment