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

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
  • Comment on RE: RE: Monkifying posts is too rough (solution, not rant :)