in reply to Monkifying posts is too rough (solution, not rant :)

JavaScript? Who let that in? :-)

Hang your head in shame...
  • Comment on RE: Monkifying posts is too rough (solution, not rant :)

Replies are listed 'Best First'.
RE: RE: Monkifying posts is too rough (solution, not rant :)
by cwest (Friar) on Jun 14, 2000 at 22:38 UTC
    Do you prefer something like this? I don't care really, just as long as it get's easier to post... this is a programmatic situation, and can be handled programmaticaly.
    my $text = q{
    I like to <tt><monkify>smile ;-></monkify></tt>
    <br>
    some code:
    <pre><monkify>
    my $value = [ qw/one two/ ];
    print $value->[1];
    </monkify></pre>
    };
    
    sub fix {
      my $text = shift;
    
      my $good = {
                  '[' => '&#091;',
                  ']' => '&#093;',
                  '<' => '&lt;',
                  '>' => '&gt;',
                 };
      my $bad  = join '', map { "\\$_" } keys %{$good};
    
      $text =~ s/([$bad])/$good->{$1}/g;
    
      return $text;
    
    }
    
    $text =~ s/<monkify>(.+?)<\/monkify>/fix($1)/ges;
    
    print $text;
    
    PS: I hope I got this post right for the parser ;-)
    --
    Casey