Parse::BBCode

Module to turn BBCode into HTML or plain text
Download

Parse::BBCode Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Publisher Name:
  • Tina Müller
  • Publisher web site:
  • http://search.cpan.org/~tinita/

Parse::BBCode Tags


Parse::BBCode Description

Module to turn BBCode into HTML or plain text Parse::BBCode is a Perl module to turn BBCode into HTML or plain text.SYNOPSISTo parse a bbcode string, set up a parser with the default HTML defintions of Parse::BBCode::HTML: use Parse::BBCode; my $p = Parse::BBCode->new(); my $code = 'some b code'; my $parsed = $p->render($code);Or if you want to define your own tags: my $p = Parse::BBCode->new({ tags => { # load the default tags Parse::BBCode::HTML->defaults, # add/override tags url => 'url:%{parse}s', i => '%{parse}s', b => '%{parse}s', noparse => '%{html}s', code => sub { my ($parser, $attr, $content, $attribute_fallback) = @_; if ($attr eq 'perl') { # use some syntax highlighter $content = highlight_perl($content); } else { $content = Parse::BBCode::escape_html($$content); } "$content" }, test => 'this is klingon: %{klingon}s', }, escapes => { klingon => sub { my ($parser, $tag, $text) = @_; return translate_into_klingon($text); }, }, } ); my $code = 'some b code'; my $parsed = $p->render($code); Requirements: · Perl


Parse::BBCode Related Software