- Timestamp:
- 11/18/09 06:27:14 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm
r3986 r5573 823 823 } 824 824 825 # probe down into a list type to determine if it825 # probe down into a table to determine if it 826 826 # can be converted to TML. 827 827 sub _isConvertableTable { … … 831 831 return 0; 832 832 } 833 834 my $rowspan = undef; 835 $rowspan = [] if Foswiki::Func::getContext()->{'TablePluginEnabled'}; 833 836 834 837 my $kid = $this->{head}; … … 843 846 return 0; 844 847 } 845 my $row = $kid->_isConvertableTableRow( $options);848 my $row = $kid->_isConvertableTableRow( $options, $rowspan ); 846 849 unless ($row) { 847 850 return 0; … … 850 853 } 851 854 $kid = $kid->{next}; 855 } 856 857 if ( $rowspan and grep { $_ } @$rowspan ) { 858 859 # One or more cells span rows past the last row in the table. 860 # This is a defect in the HTML table which TML cannot represent. 861 return 0; 852 862 } 853 863 return 1; … … 865 875 } 866 876 867 # probe down into a list itemto determine if the877 # probe down into a table row to determine if the 868 878 # containing table can be converted to TML. 869 879 sub _isConvertableTableRow { 870 my ( $this, $options ) = @_;880 my ( $this, $options, $rowspan ) = @_; 871 881 872 882 return 0 if ( $this->_isProtectedByAttrs() ); … … 876 886 my $ignoreCols = 0; 877 887 my $kid = $this->{head}; 888 my $colIdx = 0; 889 while ( $rowspan and $rowspan->[$colIdx] ) { 890 push @row, $WC::NBSP . '^' . $WC::NBSP; 891 $rowspan->[$colIdx]--; 892 $colIdx++; 893 } 878 894 while ($kid) { 879 895 if ( $kid->{tag} eq 'th' ) { … … 913 929 } 914 930 if ( $kid->{attrs}->{rowspan} && $kid->{attrs}->{rowspan} > 1 ) { 915 return 0; 931 return 0 unless $rowspan; 932 $rowspan->[$colIdx] = $kid->{attrs}->{rowspan} - 1; 916 933 } 917 934 } … … 937 954 # Pad to allow wikiwords to work 938 955 push( @row, $text ); 956 $colIdx++; 939 957 while ( $ignoreCols > 1 ) { 958 if ( $rowspan and $rowspan->[$colIdx] ) { 959 960 # rowspan and colspan into the same cell 961 return 0; 962 } 940 963 push( @row, '' ); 941 964 $ignoreCols--; 965 $colIdx++; 966 } 967 while ( $rowspan and $rowspan->[$colIdx] ) { 968 push @row, $WC::NBSP . '^' . $WC::NBSP; 969 $rowspan->[$colIdx]--; 970 $colIdx++; 942 971 } 943 972 $kid = $kid->{next}; … … 1565 1594 \@table ); 1566 1595 1567 my $maxrow = 0;1568 my $row;1569 foreach $row (@table) {1570 my $rw = scalar(@$row);1571 $maxrow = $rw if ( $rw > $maxrow );1572 }1573 foreach $row (@table) {1574 while ( scalar(@$row) < $maxrow ) {1575 push( @$row, '' );1576 }1577 }1578 1596 my $text = $WC::CHECKn; 1579 foreach $row (@table) {1597 foreach my $row (@table) { 1580 1598 1581 1599 # isConvertableTableRow has already formatted the cell
Note: See TracChangeset
for help on using the changeset viewer.
