hy/site/shim.py
Paul R. Tagliamonte aecf29809f Madness. Madness.
2013-03-09 22:45:08 -05:00

36 lines
710 B
Python

#
import hy
from hy.models.expression import HyExpression
from hy.models.symbol import HySymbol
from hy.macros import macro
# (route "/" []
# (render-template "index.html"))
# (decorate-with (.route app "/")
# (defn index []
# (render-template "index.html")))
@macro("route")
def route_macro(tree):
tree.pop(0)
path = tree.pop(0)
tree.insert(0, HySymbol("fn"))
return HyExpression([HySymbol("decorate_with"),
HyExpression([HySymbol(".route"),
HySymbol("app"),
path]),
tree])
from app import app
if __name__ == '__main__':
app.run(debug=True)