Parse-BBCode
view release on metacpan or search on metacpan
lib/Parse/BBCode.pm view on Meta::CPAN
$close = $new_def->{close} if exists $new_def->{close};
$class = $new_def->{class} if exists $new_def->{class};
}
else {
}
# we have a string, compile
#warn __PACKAGE__.':'.__LINE__.": $key => $output\n";
if ($output =~ s/^(inline|block|url)://) {
$class = $1;
}
my @parts = split m!($re_split)!, $output;
#warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\@parts], ['parts']);
my @compiled;
for my $p (@parts) {
if ($p =~ m/$re_cmp/) {
my ($escape, $type) = ($1, $2);
$escape ||= 'parse';
my @escapes = split /\|/, $escape;
if (grep { $_ eq 'parse' } @escapes) {
$parse = 1;
}
lib/Parse/BBCode.pm view on Meta::CPAN
};
my @class = 'block';
while (defined $text and length $text) {
$in_url = grep { $_->get_class eq 'url' } @opened;
#warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$in_url], ['in_url']);
#warn __PACKAGE__.':'.__LINE__.": ============= match $text\n";
my $tag;
my ($before, $tag1, $tag2, $after);
if ($re_classic and $re_short) {
($before, $tag1, $tag2, $after) = split m{
(?:
\[ ($re_short) (?=://)
|
\[ ($re_classic) (?=\b|\]|\=)
)
}ix, $text, 2;
}
elsif (! $re_classic and $re_short) {
($before, $tag1, $after) = split m{
\[ ($re_short) (?=://)
}ix, $text, 2;
}
elsif ($re_classic and !$re_short) {
($before, $tag2, $after) = split m{
\[ ($re_classic) (?=\b|\]|\=)
}ix, $text, 2;
}
{ no warnings;
# warn __PACKAGE__.':'.__LINE__.": $before, $tag1, $tag2, $after)\n";
#warn __PACKAGE__.':'.__LINE__.": RE: $current_open_re\n";
}
#warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\@opened], ['opened']);
if (length $before) {
# look if it contains a closing tag
( run in 0.996 second using v1.01-cache-2.11-cpan-71847e10f99 )