add demos

This commit is contained in:
dongdigua 2023-07-25 14:38:51 +08:00
parent 5782bd8c90
commit cac7ac7164

View File

@ -1,5 +1,7 @@
#! /usr/local/bin/lua54
-- vi: set noexpandtab :vi
print("Content-Type: text/html\r\n\r\n")
print[[
@ -27,6 +29,12 @@ input {
Demo
</H1>
<DIV CLASS="menubar">
<A HREF="/demo.lua?hello">hello</A>
&middot;
</DIV>
<FORM ACTION="/demo.lua" METHOD="POST">
<TEXTAREA ROWS="16" COLS="72" NAME="input" maxlength="2000">]]
@ -51,6 +59,15 @@ local tostring=tostring
local unpack=table.unpack
local write=io.write
-- snippets
local demos = {}
demos["hello"] = "print[[hello shenjack]]"
local query=os.getenv("QUERY_STRING")
if #query > 0 then
T=demos[query]
end
-- continue HTML began in shell script
write(T)
write[[</TEXTAREA>