The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTML::BBCode - Perl extension for converting BBcode to HTML.

SYNOPSIS

  use HTML::BBCode;

  my $bbc  = HTML::BBCode->new( \%options );
  my $html = $bbc->parse($bbcode);

DESCRIPTION

HTML::BBCode converts BBCode -as used on the phpBB bulletin boards- to it's HTML equivalent.

METHODS

The following methods can be used

new

   my $bbc = HTML::BBCode->new({
      allowed_tags => [ @bbcode_tags ],
      html_tags    => \%html_tags, 
      match        => \%match, 
      substitute   => \%substitute,
      no_html      => 1,
      linebreaks   => 1,
   });

new creates a new HTML::BBCode object using the configuration passed to it. The object's default configuration allows all BBCode to be converted to the default HTML.

options

allowed_tags

Defaults to all currently know BBCode tags, being: b, u, i, color, size, quote, code, list, url, email, img. With this option, you can specify what BBCode tags you would like to convert.

html_tags

Configures the wanted output in HTML. Defaults to (almost) the same as used on the phpbb bulletin boards (<b>, <u> etc. have been turned into their CSS equivalents).

match

Specifies the regexp needed to catch the BBCode.

substitute

Specifies the substitute command for the match regexp.

no_html

Disabled by default.

When true, HTML tags will be converted from '<br />' to '&lt;br /&gt'

linebreaks

Disabled by default.

When true, will substitute linebreaks into HTML ('<br />')

parse

   my $html = $bbc->parse($bbcode); 

Parses text supplied as a single scalar string and returns the HTML as a single scalar string.

SEE ALSO

http://www.b10m.net/cgi-bin/HTML-BBCode.cgi http://www.phpbb.com/phpBB/faq.php?mode=bbcode

BUGS

Bugs? Impossible!. This module is still experimental. Please notify the author when you find bugs.

AUTHOR

M. Blom, <b10m@perlmonk.org>

COPYRIGHT AND LICENSE

Copyright (C) 2004 by M. Blom

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.