hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Batsman's 5-Line Wiki #

by why in bits

Drop the code below in a file called w7.cgi. You’ll need to give executable permission for the web server to execute the script and write permission for the web server for the whole directory. (chmod 755 wiki/w7.cgi; chown www wiki).

 #!/usr/bin/ruby -rcgi
 H,B=%w'HomePage w7.cgi?n=%s';c=CGI.new'html4';n,d=c['n']!=''?c['n']:H,c['d'];t=`
 cat #{n}`;d!=''&&`echo #{t=CGI.escapeHTML(d)} >#{n}`;c.instance_eval{out{h1{n}+
 a(B%H){H}+pre{t.gsub(/([A-Z]\w+){2}/){a(B%$&){$&}}}+form("get"){textarea('d'){t
 }+hidden('n',n)+submit}}}

Basically, you have a HomePage link and you can add other pages by adding WikiWords to the page. Great use of Ruby’s CGI class and the && operator. Watch batsman flaunt slim wikis here.

said on 04 Oct 2005 at 10:58

WikiWiki

Test

said on 22 Nov 2005 at 00:59

5 lines? With Error checking?

said on 09 Jan 2006 at 21:06

Two lines when you remove the arbitrary line breaks. :-)

Comments are closed for this entry.