Ignore:
Timestamp:
11/28/08 15:12:15 (3 years ago)
Author:
CrawfordCurrie
Message:

Item6041: fix empty bullet list Item324: get it working on Foswiki Item295: further detoxing

File:
1 edited

Legend:

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

    r811 r1043  
    4343use vars qw( $reww ); 
    4444 
    45 require Foswiki::Plugins::WysiwygPlugin::Constants; 
    46 require Foswiki::Plugins::WysiwygPlugin::HTML2TML::WC; 
     45use Foswiki::Plugins::WysiwygPlugin::Constants; 
     46use Foswiki::Plugins::WysiwygPlugin::HTML2TML::WC; 
    4747 
    4848=pod 
     
    617617        my $t; 
    618618        my $grandkid = $kid->{head}; 
    619         # IE generates spurious empty divs inside LIs. Detect and skip 
    620         # them. 
    621         if( $grandkid->{tag} =~ /^div$/i 
    622               && $grandkid == $kid->{tail} 
    623                 && scalar(keys %{$this->{attrs}}) == 0 ) { 
    624             $grandkid = $grandkid->{head}; 
    625         } 
    626         while ($grandkid) { 
    627             if( $grandkid->{tag} =~ /^[dou]l$/i ) { 
    628                 #$spawn = _trim( $spawn ); 
    629                 $t = $grandkid->_convertList( $indent.$WC::TAB ); 
    630             } else { 
    631                 ( $f, $t ) = $grandkid->generate( $WC::NO_BLOCK_TML ); 
    632                 $t =~ s/$WC::CHECKn/ /g; 
    633                 # Item5257: If this is the last child of the LI, trim 
    634                 # trailing spaces. Otherwise spaces generated by the 
    635                 # editor before the </li> will be appended to the line. 
    636                 # It is safe to remove them, as TML never depends on 
    637                 # these spaces. If there are any intentional spaces at 
    638                 # the end of protected content, these will have been 
    639                 # converted to &nbsp; and protected that way. 
    640                 $t =~ s/\s+$// unless $grandkid->{next}; 
    641             } 
    642             $spawn .= $t; 
    643             $grandkid = $grandkid->{next}; 
     619        if ($grandkid) { 
     620            # IE generates spurious empty divs inside LIs. Detect and skip 
     621            # them. 
     622            if( $grandkid->{tag} && $grandkid->{tag} =~ /^div$/i 
     623                  && $grandkid == $kid->{tail} 
     624                    && scalar(keys %{$this->{attrs}}) == 0 ) { 
     625                $grandkid = $grandkid->{head}; 
     626            } 
     627            while ($grandkid) { 
     628                if( $grandkid->{tag} && $grandkid->{tag} =~ /^[dou]l$/i ) { 
     629                    #$spawn = _trim( $spawn ); 
     630                    $t = $grandkid->_convertList( $indent.$WC::TAB ); 
     631                } else { 
     632                    ( $f, $t ) = $grandkid->generate( $WC::NO_BLOCK_TML ); 
     633                    $t =~ s/$WC::CHECKn/ /g; 
     634                    # Item5257: If this is the last child of the LI, trim 
     635                    # trailing spaces. Otherwise spaces generated by the 
     636                    # editor before the </li> will be appended to the line. 
     637                    # It is safe to remove them, as TML never depends on 
     638                    # these spaces. If there are any intentional spaces at 
     639                    # the end of protected content, these will have been 
     640                    # converted to &nbsp; and protected that way. 
     641                    $t =~ s/\s+$// unless $grandkid->{next}; 
     642                } 
     643                $spawn .= $t; 
     644                $grandkid = $grandkid->{next}; 
     645            } 
    644646        } 
    645647        #$spawn = _trim($spawn); 
Note: See TracChangeset for help on using the changeset viewer.