An entry in the ShortestWikiContest. WyRiki is 20 lines of unreadable Ruby code. The design was shamelessly stolen from the WyPy entry.
You can see the code here: http://onestepback.org/misc/wyriki.txt.
There is a live version at http://onestepback.org/cgi-bin/wyriki.
The author confesses to writing it late at night when his better judgment was impaired. Plus, leaving off the final "i" in WyRiki gives a phonetic spelling of the author's name (which is the real reason he wrote it).
-- JimWeirich
Please add wrap=soft or wrap=virtual to the textarea definition.
This source is from http://web.archive.org/web/20070222033318/http://onestepback.org/misc/wyriki.txt -- MarkusSrank
#!/usr/local/bin/ruby
require 'cgi';def load(n) File.exist?("w/"+n) ? File.read("w/"+n) : end
def fs(s) s.gsub!(/\r/,);s.gsub!(/^---/, "
");s.gsub!(/^\{\{$/, "\n")
s.gsub!(/^}}$/, "");s.gsub!(/^\* /, "");s.gsub!(/\n\n/, "")
s.gsub!(/(^|[^A-Za-z0-9?])(([A-Z][a-z]+){2,})/) {$1+(File.exist?('w/'+$2) ?
%{#{$2}}:$2+%[?]+
%[])};s.gsub!(/(ht|f)tp:[^<>"\s]+/){ %{#{$&}}};s end
def pg(m,n) {'get'=>%{
WyRiki:#{n}
(edit me)#{fs(load(n))||n}},'edit'=>
%{
},'find'=>"Links: #{fs(n.dup)}
"+fs(Dir['w/*'].select{
|fn| File.read(fn).include?(n)}.collect{|s|"\n* "+s[2..-1]}.join)}[m] end
def main(f) n=f['p']||ENV['QUERY_STRING'].dup;n=(n=~/^[A-Za-z]+$/)?n:'HomePage'
print "Content-type: text/html; charset=utf-8\r\n\r\n#{n} "
open("w/"+n,"w"){|io|io.write f['t']} if ENV['REQUEST_METHOD']=='POST'
print pg({'e'=>'edit', 'f'=>'find'}[f['q']] || 'get', n) end
main Hash[ *CGI.new.params.collect{|k,v| [k,v[0]]}.flatten ] if __FILE__==$0