-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
17 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#!/bin/bash | ||
|
||
TEMPLATE_DIR=templates | ||
PUBLIC_DIR=public | ||
TEMPLATE_DIR='templates/' | ||
PUBLIC_DIR='public' | ||
|
||
for template in `git diff-index --name-only HEAD --relative=${TEMPLATE_DIR}` | ||
do | ||
ofile=${PUBLIC_DIR}${template/%mako/html} | ||
python scripts/render.py ${template} > ${ofile} || return fail | ||
ofile=${PUBLIC_DIR}/${template/%mako/html} | ||
python scripts/render.py ${template} > ${ofile} || exit -1 | ||
git add ${ofile} | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/home/phoenix/rstmako | ||
example mako template | ||
this is a disaster | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
#!/usr/bin/python | ||
|
||
import sys | ||
import sys ,os | ||
|
||
from mako.template import Template | ||
from mako.lookup import TemplateLookup | ||
|
||
mylookup = TemplateLookup(directories=['../templates'], module_directory='/tmp/mako_modules') | ||
lookup = TemplateLookup(directories=['templates'], module_directory='/tmp/mako_modules') | ||
|
||
def serve_template(templatename, **kwargs): | ||
mytemplate = mylookup.get_template(templatename) | ||
print mytemplate.render(**kwargs) | ||
|
||
#here we read all the makos and render them | ||
for arg in sys.argv: | ||
serve_template(arg) | ||
def main(argv): | ||
for arg in argv: | ||
print lookup.get_template(arg).render() | ||
|
||
print os.getcwd() | ||
if __name__ == "__main__": | ||
main(sys.argv[1:]) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
example mako template | ||
re-re-render | ||
this is a disaster |