From 34e10a4dba57b5c5e01d8e5b8debc69fbc793e83 Mon Sep 17 00:00:00 2001 From: "Paul R. Tagliamonte" Date: Sat, 9 Mar 2013 23:16:04 -0500 Subject: [PATCH] unmehing. --- site/app.hy | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/site/app.hy b/site/app.hy index 0fdb841..7b4b852 100644 --- a/site/app.hy +++ b/site/app.hy @@ -6,44 +6,8 @@ (import-from flask Flask render-template) -(import-from pygments highlight) -(import-from pygments.lexers PythonLexer ClojureLexer) -(import-from pygments.formatters HtmlFormatter) -(import codegen) - - -(def lexers {"python" (PythonLexer) - "lisp" (ClojureLexer)}) - (def app (Flask "__main__")) ; long story, needed hack (route "/" [] (render-template "index.html")) - - -(defn colorize-python [x] - (highlight x (index lexers "python") (HtmlFormatter))) - - -(defn hy-to-py [hython] - (.to_source codegen (forge-ast "stdin" (tokenize hython)))) - - -(decorate-with (kwapply (.route app "/format/") {"methods" ["POST"]}) - (defn format-code [language] - "Language HTML Formatter" - (highlight - (index request.form "code") (index lexers language) (HtmlFormatter)))) - - -(decorate-with (kwapply (.route app "/hy2py") {"methods" ["POST"]}) - (defn translate-code [] - "Pythonic converter" - (hy-to-py (index request.form "code")))) - - -(decorate-with (kwapply (.route app "/hy2pycol") {"methods" ["POST"]}) - (defn translate-code-with-color [] - "Pythonic converter" - (colorize-python (hy-to-py (index request.form "code")))))