Doing some small bits.
This commit is contained in:
parent
ac1e8ebb16
commit
2cbcc0fd13
@ -28,6 +28,8 @@
|
|||||||
; view routes
|
; view routes
|
||||||
(route "/" [] (render-template "index.html"))
|
(route "/" [] (render-template "index.html"))
|
||||||
|
|
||||||
|
(route "/repl" [] (render-template "repl.html"))
|
||||||
|
|
||||||
(post-route "/hy2py" []
|
(post-route "/hy2py" []
|
||||||
(try (hy-to-py (get request.form "code"))
|
(try (hy-to-py (get request.form "code"))
|
||||||
(catch LexException (err "Incomplete Code."))
|
(catch LexException (err "Incomplete Code."))
|
||||||
|
@ -1,13 +1,29 @@
|
|||||||
body, html {
|
.reset {
|
||||||
height: 100%;
|
padding: 0px;
|
||||||
padding: 0px;
|
margin: 0px;
|
||||||
margin: 0px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body, html {
|
||||||
|
height: 100%;
|
||||||
|
background-color: #141414;
|
||||||
|
color: #DCDCDC;
|
||||||
|
font-family: monospace;
|
||||||
|
.reset;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #DCDCDC;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
.reset;
|
||||||
|
}
|
||||||
|
|
||||||
.repl {
|
.repl {
|
||||||
width: 49.9%;
|
width: 49.9%;
|
||||||
height: 90%;
|
height: 90%;
|
||||||
|
.reset;
|
||||||
}
|
}
|
||||||
|
|
||||||
#python-repl {
|
#python-repl {
|
||||||
@ -21,6 +37,10 @@ body, html {
|
|||||||
border-left: 1px solid #DCDCDC;
|
border-left: 1px solid #DCDCDC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#hython-target {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.clear {
|
.clear {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
@ -28,7 +48,4 @@ body, html {
|
|||||||
#build-msgs {
|
#build-msgs {
|
||||||
border-top: 1px solid #DCDCDC;
|
border-top: 1px solid #DCDCDC;
|
||||||
height: 10%;
|
height: 10%;
|
||||||
background-color: #141414;
|
|
||||||
color: #DCDCDC;
|
|
||||||
font-family: monospace;
|
|
||||||
}
|
}
|
||||||
|
@ -3,41 +3,20 @@
|
|||||||
{% block title %}Welcome!{% endblock %}
|
{% block title %}Welcome!{% endblock %}
|
||||||
|
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<script src="{{url_for("static", filename="js/codemirror.js")}}"></script>
|
|
||||||
<link rel="stylesheet" href="{{url_for("static", filename="css/codemirror.css")}}">
|
|
||||||
<link rel="stylesheet" href="{{url_for("static", filename="css/themes/twilight.css")}}">
|
|
||||||
<script src="{{url_for("static", filename="js/mode/clojure/clojure.js")}}"></script>
|
|
||||||
<script src="{{url_for("static", filename="js/mode/python/python.js")}}"></script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block tail %}
|
{% block content %}
|
||||||
<script src="{{url_for("static", filename="js/main.js")}}"></script>
|
<h1>Hi, Welcome to Hy!</h1>
|
||||||
{% endblock %}
|
|
||||||
|
<p>
|
||||||
{% block content %}{#{% autoescape off %}{% code "clojure" %} (print "foo bar") {% endcode %}{% endautoescape %}#}
|
Hy is a special Lisp langage. It compiles into a Python AST, and allows for
|
||||||
<div class='repl' id='hython-repl'>
|
some pretty awesome stuff (like writing Flask or Django apps in Lisp).
|
||||||
<textarea id="hython-target">
|
</p>
|
||||||
;;;; This is Hy. Hy is a Lisp variant that "compiles" to Python ASTs.
|
<p>
|
||||||
;;;; This pane is the Hy lisp variant, and the left side is what the output
|
It's got an extremely simple Macro system, which will hopefully become
|
||||||
;;;; AST looks like using the `codegen` module.
|
a bit more advanced as the language develops.
|
||||||
|
</p>
|
||||||
(defn square [x]
|
<p>
|
||||||
"This function will square a number"
|
Want to try it out? Flip on JavaScript and try out the <a href="/repl" >REPL</a>
|
||||||
(* x x))
|
</p>
|
||||||
|
|
||||||
(print (square 2))
|
|
||||||
|
|
||||||
|
|
||||||
;; we even do some minor mangling:
|
|
||||||
;; (dashes turn to underscores)
|
|
||||||
|
|
||||||
;(defn add-two-numbers [x y]
|
|
||||||
; (+ x y))
|
|
||||||
;(print (add-two-numbers 1 2))
|
|
||||||
|
|
||||||
</textarea>
|
|
||||||
</div>
|
|
||||||
<div class='repl' id='python-repl'></div>
|
|
||||||
<div class='clear'></div>
|
|
||||||
<div class='msgs' id='build-msgs'></div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
43
site/templates/repl.html
Normal file
43
site/templates/repl.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Welcome!{% endblock %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
<script src="{{url_for("static", filename="js/codemirror.js")}}"></script>
|
||||||
|
<link rel="stylesheet" href="{{url_for("static", filename="css/codemirror.css")}}">
|
||||||
|
<link rel="stylesheet" href="{{url_for("static", filename="css/themes/twilight.css")}}">
|
||||||
|
<script src="{{url_for("static", filename="js/mode/clojure/clojure.js")}}"></script>
|
||||||
|
<script src="{{url_for("static", filename="js/mode/python/python.js")}}"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block tail %}
|
||||||
|
<script src="{{url_for("static", filename="js/main.js")}}"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}{#{% autoescape off %}{% code "clojure" %} (print "foo bar") {% endcode %}{% endautoescape %}#}
|
||||||
|
<div class='repl' id='hython-repl'>
|
||||||
|
<textarea id="hython-target">
|
||||||
|
;;;; This is Hy. Hy is a Lisp variant that "compiles" to Python ASTs.
|
||||||
|
;;;; This pane is the Hy lisp variant, and the left side is what the output
|
||||||
|
;;;; AST looks like using the `codegen` module.
|
||||||
|
|
||||||
|
(defn square [x]
|
||||||
|
"This function will square a number"
|
||||||
|
(* x x))
|
||||||
|
|
||||||
|
(print (square 2))
|
||||||
|
|
||||||
|
|
||||||
|
;; we even do some minor mangling:
|
||||||
|
;; (dashes turn to underscores)
|
||||||
|
|
||||||
|
;(defn add-two-numbers [x y]
|
||||||
|
; (+ x y))
|
||||||
|
;(print (add-two-numbers 1 2))
|
||||||
|
|
||||||
|
</textarea>
|
||||||
|
</div>
|
||||||
|
<div class='repl' id='python-repl'></div>
|
||||||
|
<div class='clear'></div>
|
||||||
|
<div class='msgs' id='build-msgs'></div>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user