A ABBR ACRONYM B BIG CITE CODE DFN EM I KBD SAMP SMALL SPAN STRONG SUB SUP TT VAR #### A I #### I|style="color:blue"> #### package Base::HTML::Inline; use strict; use warnings; use Exporter qw(import); our @EXPORT_OK = qw(inline); use Text::Balanced qw(extract_bracketed extract_multiple); use Util::FancySplice; my $allowed = join('|', qw(A ABBR ACRONYM B BIG CITE CODE DFN EM I KBD Q SAMP SMALL SPAN STRONG SUB SUP TT VAR)); sub inline { my ($text) = @_; $text =~ s/\s\', qr(.*?(?=<)) ) } ] )); my $end = undef; if (scalar @{$brackets->[-1]} == 1) { $end = shift $brackets->[-1]; pop @{$brackets}; } my $line; for my $bracket (@$brackets) { (my $start = $bracket->[0]) =~ s/^(.+|)\b(.+)$/$1/; (my $tag = $bracket->[0]) =~ s/^(.+|)\b(.+)$/$2/; if ($tag && $tag =~ /^(.+|)($allowed)$/) { $start .= $1; $tag = lc $2; } else { $tag = lc $tag; } (my $tagged = $bracket->[1]) =~ s/^\<(.+)\>$/$1/; my @in_parts = split(/\|/,$tagged); my $attribute = scalar @in_parts > 1 && $in_parts[-1] !~ /\>/ ? ' '.pop @in_parts : ''; my $in_tag = join('|',@in_parts); $in_tag = $in_tag =~ /\$in_tag"; } $line .= $end if $end; return $line; } 1; #### my $text = 'Anyone who watches the Syfy channel knows that on Monday nights they aired three television series Ika|href="Movies_by_series.pl?series=EWA#EUReKA">|class="title">, I>, and I>. Some might not be aware that these three series have formed a crossover cosmology which I call A '; #### $VAR1 = [ 'Anyone who watches the Syfy channel knows that on Monday nights they aired three television series I', 'ka|href="Movies_by_series.pl?series=EWA#EUReKA">>', ', I', '>', ', and I', '>', '. Some might not be aware that these three series have formed a crossover cosmology which I call A', '', '.' ]; #### sub fancy_splice { my ($amount, @in_list) = @_; my $list; while (@in_list) { push @$list,[splice(@in_list,0,$amount)]; } return $list; } #### $VAR1 = [ [ 'Anyone who watches the Syfy channel knows that on Monday nights they aired three television series I', 'ka|href="Movies_by_series.pl?series=EWA#EUReKA">|class="title">' ], [ ', I', '>' ], [ ', and I', '>' ], [ '. Some might not be aware that these three series have formed a crossover cosmology which I call A', '' ], [ '.' ] ]; #### Anyone who watches the Syfy channel knows that on Monday nights they aired three television series Eureka, Warehouse 13, and Alphas. Some might not be aware that these three series have formed a crossover cosmology which I call EWA