Skip Menu |

This queue is for tickets about the AUBBC CPAN distribution.

Report information
The Basics
Id: 61458
Status: resolved
Priority: 0/
Queue: AUBBC

People
Owner: Nobody in particular
Requestors: TINITA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in:
  • 3.00
  • 1.0
  • 1.0R
  • 1.10
  • 1.10R
  • 1.20
  • 1.30
  • 2.0
  • 2.10
  • 2.10-withoutworldwriteables
  • 2.20
  • 2.20-withoutworldwriteables
  • 2.21
  • 3.13
  • 4.00
  • 4.01
  • 4.02
Fixed in: 4.03



Subject: Unbalanced tags result in unbalanced HTML
Hi, if I wanted to use a bbcode to html converter in a public web forum, for example, I would not want to ceate it invalid HTML. Unbalanced HTML tags for example. They could break the whole layout I guess. Here is an example: use AUBBC; my $p = AUBBC->new; my $bbcode = "[i] italic [b]bold[/b] end"; my $html = $p->do_all_ubbc($bbcode); print $html; output: <i> italic <b>bold</b> end Is there an option to prevent that? I believe the reason for the broken HTML is that the bbcode tags are parsed independently, so an [i] or an [/i] is replaced by <i> or </i> no matter if there is an opening or and tag at all. thanks
On Sun Sep 19 07:03:10 2010, TINITA wrote: Show quoted text
> Hi, > > if I wanted to use a bbcode to html converter in a public web forum, > for example, I would not want to ceate it invalid HTML. Unbalanced
HTML Show quoted text
> tags for example. They could break the whole layout I guess. > > > Is there an option to prevent that? I believe the reason for the
broken Show quoted text
> HTML is that the bbcode tags are parsed independently, so an [i] or
an Show quoted text
> [/i] is replaced by <i> or </i> no matter if there is an opening or
and Show quoted text
> tag at all. > > thanks
Lets not try to fool people in making them think your really going to use my module for a real forum. http://search.cpan.org/~tinita/ the maintainer of Parse::BBCode. LOL Yes 3.00 has settings that can be changed to not allow unbalanced tags. But if you can deal with the unbalanced tags by moderating the web forum then AUBBC will run a lot faster. By using this method you can loos tags like code/c, url, email, quote, img/left/right, center/left/right, and other tags the aubbc setting can support. Build your own tags will not convert unbalanced tags and this example below has a few tags but not all. The rest you can make. Example: use AUBBC; my $aubbc = AUBBC->new; $aubbc->settings(aubbc => 0,); my @other_tags = ('b','i','big','small','p','pre','sup','sub','h1','h2','h3','h4','h5','h 6'); foreach my $tag (@other_tags) { $aubbc->add_build_tag( name => $tag, pattern => 'all', type => 2, function =>'main::other_tags', # use main:: or Module_Name:: . ); } my $bbcode = "[i] italic [b]bold[/b] end"; my $html = $aubbc->do_all_ubbc($bbcode); print $html; # Output: [i] italic <b>bold</b> end sub other_tags { my ($tag_name, $text_from_AUBBC) = @_; ($tag_name) ? return "<$tag_name>$text_from_AUBBC</$tag_name>" : return ''; } # End Maybe the next update I will change the tags in aubbc to not allow unbalanced tags, but for now this can be the work around.
This bug is fixed as of version 4.03 will not convert unbalanced tags.