Madness. Madness.
This commit is contained in:
parent
4f856c35d4
commit
aecf29809f
1
requirements-site.txt
Normal file
1
requirements-site.txt
Normal file
@ -0,0 +1 @@
|
||||
flask
|
10
site/app.hy
Normal file
10
site/app.hy
Normal file
@ -0,0 +1,10 @@
|
||||
;
|
||||
|
||||
(import-from flask
|
||||
Flask render-template request)
|
||||
|
||||
|
||||
(def app (Flask "__main__")) ; long story, needed hack
|
||||
|
||||
|
||||
(route "/" [] (render-template "index.html"))
|
35
site/shim.py
Normal file
35
site/shim.py
Normal file
@ -0,0 +1,35 @@
|
||||
#
|
||||
|
||||
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)
|
0
site/templates/index.html
Normal file
0
site/templates/index.html
Normal file
Loading…
x
Reference in New Issue
Block a user