Menno Blom > HTML-BBCode-2.06 > HTML::BBCode

Download:
HTML-BBCode-2.06.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 2.06   Source   Latest Release: HTML-BBCode-2.07

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);

  # Input
  print $bbc->{bbcode};

  # Output
  print $bbc->{html};

DESCRIPTION ^

HTML::BBCode converts BBCode -as used on the phpBB bulletin boards- to its HTML equivalent.

Please note that, although this was the first BBCode module, it's by far not the best nor fastest. It's also not heavilly maintained, so you might want to look at BBCode::Parser and Parse::BBCode.

METHODS

The following methods can be used

new

   my $bbc = HTML::BBCode->new({
      allowed_tags => [ @bbcode_tags ],
      stripscripts => 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.

stripscripts

Enabled by default, this option will remove all the XSS trickery (and thus is probably best not to turn it off).

no_html

This option has been removed since version 2.0

no_jslink

This option has been removed since version 2.0

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.

CAVEAT: API CHANGES ^

Please do note that the html_tags, no_html, no_jslink options in the new method have been removed since version 2.0 due to the XSS protection (provided by HTML::StripScripts::Parser). This will most likely break your current scripts (if you used the html_tags option).

SEE ALSO ^

BUGS ^

Bugs? Impossible!. Please report bugs to http://rt.cpan.org/Ticket/Create.html?Queue=HTML-BBCode.

AUTHOR ^

Menno Blom, <blom@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2004-2009 by Menno Blom

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

syntax highlighting: