#!/usr/bin/perl print "Content-type: text/html\n\n"; use CGI qw/:standard :netscape/; use POSIX qw/strftime/; $page = param(page) || substr(path_info(),1) || 1; ($q,$ext) = $ENV{SCRIPT_NAME} eq $ENV{PATH_INFO} ? ('?page=','') : ('','.html'); $data = join("",); $data = "$1$2$2$3" while ($data =~ /(.*\n)(===.*?\n)\.\.\.\n(.*)/s); @data = split(/\n===\s*/s, join("",$data)); ($title, $body) = ($data[$page] =~ /(.*?) ===\s+(.*)/s); print < ETCON: $title EOH if ($page =~ /contents-?(\d*)/) { $page = $1 || 1; shift @data; $prev=''; foreach $page (@data) { ($title, $body) = ($page =~ /(.*?) ===\s+(.*)/s); $i++; next if $prev eq $title; $prev=$title; push @contents,"* <% $title %>\n"; } undef @data; for ($i=0; $i<=$#contents; $i++) { $data[int($i/8)+1] .= $contents[$i]; } $title="Contents"; $body="#pragma compact\n" . $data[$page]; $q .= "contents-"; } print "\n" unless ($prev=$page-1)<1; print "\n" unless ($next=$page+1)>$#data; $compact=1 if $body =~ s/#pragma compact\s*//; @chunks = split(/<%(.*?)%>/ms, $body); for ($i=0; $i<@chunks; $i+=2) { $chunks[$i] =~ s/&/&/msg; $chunks[$i] =~ s/\n/msg; $chunks[$i] =~ s/ /  /g; $chunks[$i] =~ s/^~~ (.*)/

\1<\/p>/mg; $chunks[$i] =~ s/^~ (.*)/

\1<\/div>/mg; $chunks[$i] =~ s/^! (.*)/

\1<\/p>/mg; $chunks[$i] =~ s/\*(\w+)\*/\1<\/b>/mg; $chunks[$i] =~ s/_(\w+)_/\1<\/i>/mg; $chunks[$i] =~ s/\[(\S*\.png)\]//g; $chunks[$i] =~ s/\[(\S*\.jpg) (.*?)\]//g; $chunks[$i] =~ s/\[(\S*\.html?)\]/\1<\/a>/g; $chunks[$i] =~ s/\[(.*?) (\S*\.html?)\]/\1<\/a>/g; $chunks[$i] =~ s/\[(http:\S*) (.*?)\]/\2<\/a>/g; $chunks[$i] =~ s/\[:(.*?):\]/\1<\/tt>/g; $chunks[$i] =~ s/\[:(.*?):\]/

\1<\/pre>/msg;
  $chunks[$i] =~ s/\["(.*?)"\]/
\1<\/blockquote>/msg; $chunks[$i] =~ s/\[&(#?\w+);]/&\1;/g; } $body=join('',@chunks); print "\n

$title

\n\n"; print "
\n"; $ul = 0; $ol = 0; foreach $line (split("\n",$body)) { ($stars,$line) = ($line =~ /(?:(\*+)\s*)?(.*)/); print "
    " while $ul++" while --$ul>length($stars); ($hashes,$line) = ($line =~ /(#*)(.*)/); print "
      " while $ol++" while --$ol>length($hashes); print "
    1. " if $stars or $hashes; $line .= "
      \n
      " if !defined($compact); print "$line"; $stars = $hashes = undef; } print "
\n" while $ul-->0; print "\n" while $ol-->0; print "\n\n\n"; __DATA__ === === === ETCON 2005 === ~ [../images/BTTF.jpg Back To The Future] === Disclaimer === #pragma compact * You should not ride on intense rides if you have had recent surgery, are pregnant, have back, neck or heart conditions or subject to motion sickness. You should not ride on any rides if you are shorter than the height restriction which is there for safety reasons. * Obey all rules when on the ride which include keeping all parts of your body inside the vehicle at all times, stay seated and wear the restraints. Failure to observe the rules could result in injury and/or expulsion from the park. === ETCON 2005 === <%