Mercurial Hosting > luan
comparison src/luan/modules/http/tools/Run.luan @ 1293:007ceb8dcf89
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 06 Jan 2019 14:09:24 -0700 |
parents | 299996e03876 |
children | 9eba6bf0163b |
comparison
equal
deleted
inserted
replaced
1292:a6892dcf5659 | 1293:007ceb8dcf89 |
---|---|
32 <html> | 32 <html> |
33 <head> | 33 <head> |
34 <title>Run Luan Code</title> | 34 <title>Run Luan Code</title> |
35 <style> | 35 <style> |
36 body { | 36 body { |
37 font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | 37 font-family: sans-serif; |
38 text-align: center; | 38 text-align: center; |
39 margin-top: 1em; | |
40 } | |
41 h2 { | |
42 margin-bottom: .3em; | |
43 font-weight: normal; | |
44 } | 39 } |
45 textarea { | 40 textarea { |
46 font: inherit; | 41 font: inherit; |
47 border-radius: 4px; | |
48 padding: .5em .8em; | |
49 } | 42 } |
50 input[type="submit"] { | 43 input[type="submit"] { |
51 margin-top: .3em; | 44 margin-top: .3em; |
52 color: white; | 45 color: white; |
53 background: #337ab7; | 46 background: #337ab7; |
54 border-color: #337ab7; | 47 border-color: #337ab7; |
55 font: inherit; | 48 font: inherit; |
56 padding: .5em; | 49 padding: .5em; |
57 border-radius: 4px; | 50 border-radius: 4px; |
58 } | 51 cursor: pointer; |
59 input[type="submit"]:hover { | |
60 background: #236aa7 !important; | |
61 } | 52 } |
62 </style> | 53 </style> |
63 </head> | 54 </head> |
64 <body> | 55 <body> |
65 <h2>Run Luan Code</h2> | 56 <h2>Run Luan Code</h2> |
66 <form method="post"> | 57 <form method="post"> |
67 <input type="hidden" name="content_type" value="text/plain; charset=utf-8" /> | 58 <input type="hidden" name="content_type" value="text/plain; charset=utf-8" /> |
68 <div> | 59 <div> |
69 <textarea name="code" rows="20" cols="90" wrap="off" autofocus></textarea> | 60 <textarea name="code" rows="20" cols="90" autofocus></textarea> |
70 </div> | 61 </div> |
71 <div> | 62 <div> |
72 <input type="submit" value="Execute Luan Code"/> | 63 <input type="submit" value="Execute Luan Code"/> |
73 </div> | 64 </div> |
74 </form> | 65 </form> |
89 end | 80 end |
90 try { | 81 try { |
91 function() | 82 function() |
92 local run = load(code,"<web_run>") | 83 local run = load(code,"<web_run>") |
93 run() | 84 run() |
94 end; | 85 end |
95 catch = function(e) | 86 catch = function(e) |
96 Http.response.reset() | 87 Http.response.reset() |
97 Http.response.headers["content-type"] = "text/plain; charset=utf-8" | 88 Http.response.headers["content-type"] = "text/plain; charset=utf-8" |
98 Io.stdout = Http.response.text_writer() | 89 Io.stdout = Http.response.text_writer() |
99 print(e) | 90 print(e) |
100 print"" | 91 print() |
101 print"" | 92 print() |
102 print_with_line_numbers(code) | 93 print_with_line_numbers(code) |
103 end; | 94 end |
104 } | 95 } |
105 end | 96 end |
106 | 97 |
107 return Run | 98 return Run |