Created
March 6, 2012 20:50
-
-
Save stefanv/1988911 to your computer and use it in GitHub Desktop.
Transmogrify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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