Skip to content

Instantly share code, notes, and snippets.

@stefanv
Created March 6, 2012 20:50
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 stefanv/1988911 to your computer and use it in GitHub Desktop.
Save stefanv/1988911 to your computer and use it in GitHub Desktop.
Transmogrify
Dear all,
Here's a list of attendees, in alphabetical order:
{{py:
attendees = [
"Van der Walt, Stefan",
"Laurie, Dirk",]
}}
{{for s in sorted(attendees)}}
- {{s}}
{{endfor}}
Regards,
{{author}}
#!/usr/bin/env python
import tempita
import os
import sys
config = {'author': 'Stefan'}
if not len(sys.argv) == 2:
print "Usage: tm.py file"
sys.exit(-1)
fn = sys.argv[1]
if not os.path.exists(fn):
print "Cannot open file: %s" % fn
sys.exit(-1)
template = tempita.HTMLTemplate(open(fn, 'r').read())
print template.substitute(config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment