--- loncom/xml/style.pm 2003/09/22 13:01:57 1.19 +++ loncom/xml/style.pm 2008/11/24 18:55:01 1.22 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Style Parser Module (new version) # -# $Id: style.pm,v 1.19 2003/09/22 13:01:57 sakharuk Exp $ +# $Id: style.pm,v 1.22 2008/11/24 18:55:01 jms Exp $ # # Copyright Michigan State University Board of Trustees # @@ -49,10 +49,10 @@ sub styleparser { my ($target,$content_style_string)=@_; my @keys = (); my @values = (); - my @style_array = (); my $current_value; my $allow=0; my $pstyle = HTML::TokeParser->new(\$content_style_string); + $pstyle->xml_mode('1'); while (my $stoken = $pstyle->get_token) { if (($stoken->[0] eq 'S') && ($stoken->[1] eq 'definetag')) { push @keys,$stoken->[2]->{'name'}; @@ -113,10 +113,12 @@ sub styleparser { } } } + my %style_for_target; for (my $i=0; $i<=$#keys; $i++) { - push @style_array,$keys[$i],$values[$i]; + if ($values[$i] !~ /^\s*$/) { + $style_for_target{$keys[$i]}=$values[$i]; + } } - my %style_for_target = @style_array; return %style_for_target; } @@ -161,3 +163,32 @@ sub testvalue { 1; __END__ + +=pod + +=head1 NAME + +Apache::style.pm + +=head1 SYNOPSIS + +Style parsing module + +This is part of the LearningOnline Network with CAPA project +described at http://www.lon-capa.org. + + +=head1 SUBROUTINES + +=over + +=item styleparser() + +=item testkey() + +=item testvalue() + +=back + +=cut +