Doing some small bits.
This commit is contained in:
parent
ac1e8ebb16
commit
2cbcc0fd13
@ -28,6 +28,8 @@
|
||||
; view routes
|
||||
(route "/" [] (render-template "index.html"))
|
||||
|
||||
(route "/repl" [] (render-template "repl.html"))
|
||||
|
||||
(post-route "/hy2py" []
|
||||
(try (hy-to-py (get request.form "code"))
|
||||
(catch LexException (err "Incomplete Code."))
|
||||
|
@ -1,13 +1,29 @@
|
||||
body, html {
|
||||
height: 100%;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
.reset {
|
||||
padding: 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 {
|
||||
width: 49.9%;
|
||||
height: 90%;
|
||||
.reset;
|
||||
}
|
||||
|
||||
#python-repl {
|
||||
@ -21,6 +37,10 @@ body, html {
|
||||
border-left: 1px solid #DCDCDC;
|
||||
}
|
||||
|
||||
#hython-target {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
@ -28,7 +48,4 @@ body, html {
|
||||
#build-msgs {
|
||||
border-top: 1px solid #DCDCDC;
|
||||
height: 10%;
|
||||
background-color: #141414;
|
||||
color: #DCDCDC;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
@ -3,41 +3,20 @@
|
||||
{% 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>
|
||||
{% block content %}
|
||||
<h1>Hi, Welcome to Hy!</h1>
|
||||
|
||||
<p>
|
||||
Hy is a special Lisp langage. It compiles into a Python AST, and allows for
|
||||
some pretty awesome stuff (like writing Flask or Django apps in Lisp).
|
||||
</p>
|
||||
<p>
|
||||
It's got an extremely simple Macro system, which will hopefully become
|
||||
a bit more advanced as the language develops.
|
||||
</p>
|
||||
<p>
|
||||
Want to try it out? Flip on JavaScript and try out the <a href="/repl" >REPL</a>
|
||||
</p>
|
||||
{% 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…
x
Reference in New Issue
Block a user