Ignore:
Timestamp:
05/27/09 19:54:07 (3 years ago)
Author:
MichaelTempest
Message:

Item1667: perltidy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm

    r3985 r3986  
    361361    return $text; 
    362362} 
     363 
    363364# collapse adjacent nodes together, if they share the same class 
    364 sub _collapseOneClass 
    365 { 
    366     my $node = shift; 
    367         my $class = shift; 
    368         if ( defined( $node->{tag} ) && $node->hasClass($class) ) { 
    369                 my $next = $node->{next}; 
    370                 my @edible; 
    371                 my $collapsible; 
    372                 while ( 
    373                         $next 
    374                         && ( 
    375                                 ( !$next->{tag} && $next->{text} =~ /^\s*$/ ) 
    376                                 || (   $node->{tag} eq $next->{tag} 
    377                                         && $next->hasClass($class) ) 
    378                         ) 
    379                   ) 
    380                 { 
    381                         push( @edible, $next ); 
    382                         $collapsible ||= $next->hasClass($class); 
    383                         $next = $next->{next}; 
    384                 } 
    385                 if ($collapsible) { 
    386                         foreach my $meal (@edible) { 
    387                                 $meal->_remove(); 
    388                                 if ( $meal->{tag} ) { 
    389                                         require Foswiki::Plugins::WysiwygPlugin::HTML2TML::Leaf; 
    390                                         $node->addChild( 
    391                                                 new Foswiki::Plugins::WysiwygPlugin::HTML2TML::Leaf( 
    392                                                         $WC::NBBR) 
    393                                         ); 
    394                                         $node->_eat($meal); 
    395                                 } 
    396                         } 
    397                 } 
    398         } 
    399 } 
    400  
     365sub _collapseOneClass { 
     366    my $node  = shift; 
     367    my $class = shift; 
     368    if ( defined( $node->{tag} ) && $node->hasClass($class) ) { 
     369        my $next = $node->{next}; 
     370        my @edible; 
     371        my $collapsible; 
     372        while ( 
     373            $next 
     374            && ( 
     375                ( !$next->{tag} && $next->{text} =~ /^\s*$/ ) 
     376                || (   $node->{tag} eq $next->{tag} 
     377                    && $next->hasClass($class) ) 
     378            ) 
     379          ) 
     380        { 
     381            push( @edible, $next ); 
     382            $collapsible ||= $next->hasClass($class); 
     383            $next = $next->{next}; 
     384        } 
     385        if ($collapsible) { 
     386            foreach my $meal (@edible) { 
     387                $meal->_remove(); 
     388                if ( $meal->{tag} ) { 
     389                    require Foswiki::Plugins::WysiwygPlugin::HTML2TML::Leaf; 
     390                    $node->addChild( 
     391                        new Foswiki::Plugins::WysiwygPlugin::HTML2TML::Leaf( 
     392                            $WC::NBBR) 
     393                    ); 
     394                    $node->_eat($meal); 
     395                } 
     396            } 
     397        } 
     398    } 
     399} 
    401400 
    402401# Collapse adjacent VERBATIM nodes together 
     
    411410    while ( scalar(@jobs) ) { 
    412411        my $node = shift(@jobs); 
    413                 _collapseOneClass($node, 'TMLverbatim'); 
    414                 _collapseOneClass($node, 'WYSIWYG_STICKY'); 
     412        _collapseOneClass( $node, 'TMLverbatim' ); 
     413        _collapseOneClass( $node, 'WYSIWYG_STICKY' ); 
    415414        if (   $node->{tag} eq 'p' 
    416415            && $node->{head} 
     
    418417        { 
    419418            my $kid = $node->{head}; 
    420             if (   uc($kid->{tag}) eq 'SPAN' 
     419            if ( uc( $kid->{tag} ) eq 'SPAN' 
    421420                && $kid->hasClass('WYSIWYG_PROTECTED') ) 
    422421            { 
     
    465464    { 
    466465 
    467                 my %new_attrs = ( class => $class ); 
     466        my %new_attrs = ( class => $class ); 
    468467        $new_attrs{style} = $this->{attrs}->{style} 
    469468          if exists $this->{attrs}->{style}; 
Note: See TracChangeset for help on using the changeset viewer.