I don't know of any module, but it would be easy to build one.  The example
below isn't great, but it gets the job done.  I works with nested tags, but
will have problems if you use [b] or [i] inside of [url].  If you need to
add more, just add them to the %replace hash, where '<DATA>' is the data
inside of the tag.

The sample text in the script:
"[url]www.test.com[/url] [b][i]Hello[/i] World[/b]!"

Has the following output:
"<a href="http://www.test.com";>www.test.com</a> <b><i>Hello</i> World</b>!"

Rob

### CODE BELOW ###

my %replace = (
  url => '<a href="http://<DATA>"><DATA></a>',
  b => '<b><DATA></b>',
  i => '<i><DATA></i>',
);

my $text = '[url]www.test.com[/url] [b][i]Hello[/i] World[/b]!';

for (keys %replace) {
  $text =~ s|\[$_\](.*?)\[/$_\]|toHtml($replace{$_}, $1)|seg;
}

print $text;

sub toHtml {
  my $map = shift;
  my $data = shift;

  $map =~ s/<DATA>/$data/sg;
  return $map;
}



-----Original Message-----
From: Paul Murphy [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 13, 2003 4:06 AM
To: [EMAIL PROTECTED]
Subject: vb or ubb


Hi,

Does anyone know if there is a Perl module that does ubb or vb style
conversion?

So it would take data as input and scan for [url]www.test.com[/url] and
convert it to html?

Thanks,

Paul



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to