Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

­

Name: Anonymous 2009-02-19 19:04

#!/usr/bin/perl -w
use strict; use CGI ':standard';
(my $word, my $action) = map { $_ =~ s/(?:[a-z]+=)||[^A-Za-z]//g; $_ } split /\&/, $ENV{QUERY_STRING};
my $sn = ''; $word ||= 'HomePage'; $action ||= 'view'; # $sn = $ENV{SCRIPT_NAME};
my $form = "$sn?$word&action=save"; print header(-type=>'text/html',-charset=>'utf-8'),
start_html(-title=>"$word",-style=>{-src =>'/style.css'});
sub save { open my $f, '>'.$_[0]; print $f $_[1]; close $f; }
-f $word or do { $action = 'edit'; save($word, "Describe '$word' here."); };
my $text; sub readword { @ARGV = ($word); $text = "\n" . join '', <>; } readword();
$action eq 'edit' and print h3('Editing', $word),start_form(-action=>$form),
textarea('text',$text,40,80),br,submit,end_form,end_html() and exit 0;
$action eq 'save' and do { require CGI; save($word, CGI::param('text')); readword(); };
my $state = 0;
$state == 0 && $text =~ m/\G(?<=\n)( +)/cgs && print("<pre>\n$1") && $state++ or
$state == 1 && $text =~ m/\G(\n+)/cgs && print($1) or
$state == 0 && $text =~ m/\G(?<=\n)(\s*\n)+/cgs && print("<br /><br />\n") or
$state == 0 && $text =~ m/\G\n/cgs or
$state == 1 && $text =~ m/\G(?<=\n)([^ ])/cgs && print("</pre>\n$1") && $state-- && 1 or
$text =~ m/\G(\s)/cgs && print("$1") or
$state == 0 && $text =~ m{\G//(.*?)//}cgs && print("<i>$1</i>") or
$state == 0 && $text =~ m{\G_(.*?)_}cgs && print("<u>$1</u>") or
$state == 0 && $text =~ m{\G\|\|(.*?)\|\|}cgs && print("<b>$1</b>") or
$text =~ m/\G(\[)([A-Z][a-z]+[A-Z][A-Za-z]+)(\/\/)(.+?)(\])/cgs &&
print(-f $2?qq{<a href="$sn?$2">$4</a>}:qq{$2<a href="$sn?$2">?</a>}) or
$text =~ m/\G(http\:\/\/\S+)/cgs && print(qq{<a href="$1">$1</a>}) or
$text =~ m/\G(img:)(http\:\/\/\S+)/cgs && print(qq{<img src="$2" alt="$2" />}) or
$text =~ m/\G(.+?)/cgs && print("$1") or
print qq{\n<hr /><a href="$sn?$word&amp;action=edit">Edit</a>},end_html() and last while 1;

Name: Anonymous 2009-02-19 19:35

Scrub your Wiki clean with AJAX!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List