Skip to content

Instantly share code, notes, and snippets.

@trauber
Created May 22, 2011 17:33
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 trauber/985694 to your computer and use it in GitHub Desktop.
Save trauber/985694 to your computer and use it in GitHub Desktop.
Create static html with mustache and favorite markup
#! /bin/bash
# Use mustache and your favorite markup to create static html.
# Use a markup that does standard read/write or change script.
FILE=$1
MARKUP=/usr/local/bin/markdown
echo "{{content}}" > mustache.tmp
mustache $FILE mustache.tmp | $MARKUP > content.tmp
sed -n '1,/^content: *|/ p' $FILE > yml.tmp
cat content.tmp | awk '{ print " " $0 }' >> yml.tmp
echo "---" >> yml.tmp
mustache yml.tmp template.mustache
rm *.tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment