Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#!/usr/bin/lua50 -- -*- coding: raw-text-unix -*- -- #!/usr/bin/env lua50 -- This is the `blogme2-cgi.lua' file of blogme2. -- It is derived from blogme2.lua, but it is messy and experimental. -- Author and version: Eduardo Ochs <eduardoochs@gmail.com>, 2006aug19 -- License: GPL. -- (find-fline "blogme2-inner.lua") -- (find-fline "blogme2-middle.lua") -- (find-fline "blogme2-outer.lua") -- (find-fline "blogme2.lua") -- (find-blogmefile "blogme.lua" "_G[\"lua:\"]") -- Add the curent directory to LUA_PATH (if in standalone mode). -- (find-es "lua5" "require") -- LUA_PATH = LUA_PATH or os.getenv("LUA_PATH") or "?;?.lua" do local _, __, arg0path = string.find(arg[0], "^(.*)/[^/]*$") if arg0path then LUA_PATH = LUA_PATH..";"..arg0path.."/?" end end require "edrxlib.lua" require "blogme2-inner.lua" require "blogme2-middle.lua" require "blogme2-outer.lua" --;; --;; blogme --;; -- htmlize = function (title, body) -- blogme_output = HTMLIZE(title, body) -- return "" -- end -- setgetargs(vargs2, "htmlize") blogme_test = function (infname, outfname) blogme_input_fname = infname blogme_output_fname = outfname blogme_input = readfile(blogme_input_fname) subj, pos = blogme_input, 0 if checkbrackets(blogme_fname) > 0 then os.exit(1) end vparse() if blogme_output_fname then writefile(blogme_output_fname, blogme_output) else print(blogme_output) end end -- pparse("[AL foo]") -- (find-es "http") -- (find-es "http" "thttpd") -- (find-rfcfile "rfc1945.txt" "Content-Type: text/html") PP(arg) if arg[1] == "-txt" then print("Content-type: text/plain") print() elseif arg[1] == "-html" then print("Content-type: text/html") print() else print("Content-type: text/plain") print() print("Bad content option:", arg[1]) end blogme_test(arg[2]) --[[ -- A test, in (find-fline "/var/www/bcgitest.cgi") -- (find-fline "/var/www/") -- (find-sh0 "chmod 755 /var/www/bcgitest.cgi") #!/bin/sh exec /home/edrx/blogme/blogme2-cgi.lua -html $0 # exec /home/edrx/blogme/blogme2-cgi.lua -html /var/www/bcgitest.cgi #!/home/edrx/blogme/blogme2-cgi.lua -txt #!/home/edrx/blogme/blogme2-cgi.lua -txt # (find-blogmefile "blogme2-cgi.lua") # http://127.0.0.1/ # http://127.0.0.1/bcgitest.cgi # (eev "cd /var/www/; ./bcgitest.cgi") # (eev "cd /var/www/; PATH=/usr/local/bin:/bin:/usr/bin:/usr/lib/cgi-bin ./bcgitest.cgi") # (find-fline "/var/log/") # (find-fline "/var/log/thttpd.log") [htmlize Hello Hello. [PRE [lua: return getoutput("pwd; echo; set; echo; ls -lAF")]] ] --]] -- if not library then -- local i = 1 -- local infname, outfname -- while i <= arg.n do -- local a, b = arg[i], arg[i+1] -- if a == "-o" then outfname = b; i = i+2 -- elseif a == "-i" then blogme_test(b, outfname); i = i+2 -- elseif a == "-p" then relativepathto_prefix = b; i = i+2 -- elseif a == "-e" then assert(loadstring(b))(); i = i+2 -- elseif a == "-remote" then LR = R; i = i+1 -- else print("Unrecognized option: " .. a); os.exit(1) -- end -- end -- end -- blogme_test("index.blogme", "index.html") -- (find-fline "index.blogme") -- (find-fline "~/TH/math-b.blogme") -- (find-w3m "~/LUA/index.html") -- (find-fline "~/TH/webcomics.blogme") -- (find-fline "blogme2-inner.lua") -- (find-fline "blogme2-middle.lua") -- (find-fline "blogme2-outer.lua") -- (find-angg "TH/Files.tcl" "blogme") -- (find-blogmesh "blogme2.lua -o /tmp/wc.html -i ~/TH/webcomics.blogme") -- (find-blogmesh "blogme2.lua -o /tmp/i.html -i ~/TH/index.blogme") -- (find-fline "~/TH/index.blogme") -- (find-blogmesh "blogme2.lua -o /tmp/h.html -i ~/TH/heroes.blogme") -- (find-fline "~/TH/heroes.blogme") -- (find-blogmesh "blogme2.lua -o /tmp/m.html -i ~/TH/math-b.blogme") -- (find-fline "~/TH/math-b.blogme") -- (find-blogmesh "blogme2.lua -o /tmp/p.html -i ~/TH/personal.blogme") -- (find-fline "~/TH/personal.blogme") -- (find-blogmesh "blogme2.lua -o /tmp/t.html -i ~/TH/tmp-b.blogme") -- (find-fline "~/TH/tmp-b.blogme") -- (find-blogmesh "blogme2.lua -o /tmp/w.html -i ~/TH/webcomics.blogme") -- (find-fline "~/TH/webcomics.blogme") -- (find-blogmesh "blogme2-outer.lua -e 'PP(_P)'")