Sig Wik

Wiki started from scratch by CaseyWest for the ShortestWikiContest, heavily influenced by the amazing work done on FleaWi, PeeWee, and mostly PeWi.

222 Characters of Perl and Shell.

Quick instructions.

  1. make a /sig/ subdirectory in your cgi-bin
  2. upload the script into this directory, e.g as cgi-bin/sig/wik
  3. chmod 755 wik
  4. chown nobody cgi-bin/sig to make sure that the script can write to cgi-bin/sig
  5. visit /cgi-bin/sig/wik/HomePage to start creating.

Features.

Named by NicholasClark?, as it spans just four lines.

Ok, now I am amazed. -- DougMerritt

Original source code, since Casey West's web site has lost it:

 #!/usr/bin/perl
 use CGI':all';path_info=~/\w+/;$_=`grep -l $& *`.h1($&).escapeHTML$t=param(t)
 ||`dd<$&`;open F,">$&";print F$t;s/htt\S+|([A-Z]\w+){2,}/a{href,$&},$&/eg;
 print header,pre"$_<form>",submit,textarea t,$t,9,70


I've expanded SigWik a little to use css and provide Recent Changes.

 #!/usr/bin/perl
 use CGI':all';path_info=~/\w+/;$_='<div class="sb">'.`ls -1 --sort=t|head`.'</div>'.`grep -l $& *|fmt`.h1($&).
 escapeHTML$t=param(2)||`dd<$&`;open F,">$&";print F$t;s/htt\S+|([A-Z]\w+){2,}/a{href,$&},$&/eg;s/
 /br/eg;print header, "<html><head><link rel='stylesheet' type='text/css' href='/s.css'></head><body>";
 print "$_<form>",submit,textarea 2,$t,9,70
It's 5 lines. It's 371 bytes. Bloatware, I know :) And it fooking rocks!!!!


I "optimized" the css+Recent Changes version just a little bit; instead of "ls -l --sort=t" it should be possible to use "ls -lt" and there was an unnecessary space after "print header". Also I took an advantage of start_html() and stripped out one print statement. These modifications brings the file size to 312 bytes and four lines. -- Janne Pikkarainen <jaba@mikrobitti.fi>

 #!/usr/bin/perl
 use CGI':all';path_info=~/\w+/;$_='<div class="sb">'.`ls -1t|head`.'</div>'.`grep -l $& *|fmt`.h1($&).
 escapeHTML$t=param(2)||`dd<$&`;open F,">$&";print F$t;s/htt\S+|([A-Z]\w+){2,}/a{href,$&},$&/eg;s/
 /br/eg;print header,start_html(-style=>{-src=>'./s.css'})."$_<form>",submit,textarea 2,$t,9,70


When I tried using the code from Janne, I kept getting an empty file named "s" created. I fixed this by changing "./s.css" to "/s.css" Perhaps it's a bug in the version of CGI.pm I'm using. -- Troy Goodson


Wonderful. I'm using the one with css as my web notepad -- MarkusSrank


CategoryWikiImplementation


EditText of this page (last edited December 11, 2010) or FindPage with title or text search