Hi,

Thanks for the reply. I just tried a basic test with Parse::BBcode, using their example:

#!/usr/bin/perl print qq|Content-Type: text/html \n\n|; use Parse::BBCode; # \[\[([^]]+)\|([^]]+)\]\] my $test = qq|==Getting There== testing [ref]bla bla bla [[http://www.google.com]] <b> test </b> and [ +[http://www.google.com\|testing]] [/ref] hhh testing [ref]bla bla bla an[/ref] hhh |; my $p = Parse::BBCode->new({ tags => { # load the default tags Parse::BBCode::HTML->defaults, # add/override tags url => 'url:<a href="%{link}A">%{parse}s</a>', i => '<i>%{parse}s</i>', b => '<b>%{parse}s</b>', noparse => '<pre>%{html}s</pre>', 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($$conten +t); } "<tt>$content</tt>" }, test => 'this is klingon: %{klingon}s', }, escapes => { klingon => sub { my ($parser, $tag, $text) = @_; return translate_into_klingon($text); }, }, } ); my $code = $test; my $parsed = $p->render($code); use Data::Dumper; print Dumper($parsed);


..but I get an error:

Not a HASH reference at /usr/lib/perl5/vendor_perl/5.8.4/Parse/BBCode.pm line 81.

Any suggestions? I've never had much luck with those BBCode perl modules (thats why I tend to try and just do it with regex rules =))

TIA

Andy

In reply to Re^2: Regex to match between [ref] and [/ref] by ultranerds
in thread Regex to match between [ref] and [/ref] by ultranerds

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.