#!/usr/bin/perl # # simplecode.pl # # Dan Cederholm # dan@simplebits.com # v02 Feb 2004 # # Translates HTML into entity-encoded blocks # use strict; use CGI; my $q = new CGI(); my $mode = $q->param("mode"); my $html = $q->param("html"); my $encoded = $q->param("html"); my $preview = $q->param("html"); # encoded routines $encoded =~ s//>/g; $encoded =~ s/\r/
/g; $encoded =~ s/ /&#160;&#160;/g; #preview routines $preview = $encoded; $preview =~ s/&/&/g; # default form print "Content-type: text/html\n\n"; print < SimpleCode

SimpleCode

Enter normal (X)HTML in the markup box below. Press "Process" and it will spit out entity-encoded markup suitable for <code> examples. Use spaces in increments of two for nesting indents.

Enter Markup


FORM # processing and preview print <Cut n' Paste

Preview

$preview
RESULTS exit;