Changeset 10527
- Timestamp:
- 01/13/11 18:38:28 (16 months ago)
- Location:
- trunk/WysiwygPlugin
- Files:
-
- 5 edited
-
lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm (modified) (2 diffs)
-
lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm (modified) (2 diffs)
-
test/unit/WysiwygPlugin/BrowserTranslatorTests.pm (modified) (1 diff)
-
test/unit/WysiwygPlugin/ExtendedTranslatorTests.pm (modified) (1 diff)
-
test/unit/WysiwygPlugin/TranslatorTests.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/Node.pm
r10344 r10527 1590 1590 my ( $this, $options ) = @_; 1591 1591 1592 my $nbnl = $this->hasClass('WYSIWYG_NBNL'); 1593 1592 1594 if ( $this->hasClass('WYSIWYG_WARNING') ) { 1593 1595 return ( 0, '' ); … … 1623 1625 $pre = $WC::NBBR; 1624 1626 } 1627 $pre = $WC::NBBR . $pre if $nbnl; 1625 1628 return ( $f | $WC::BLOCK_TML, $pre . $kids . $WC::NBBR ); 1626 1629 } -
trunk/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm
r10083 r10527 564 564 565 565 # Blank line 566 my $class = ''; 567 if (not $inParagraph) { 568 $class = 'WYSIWYG_NBNL'; 569 } 570 $class = " class='$class'" if $class; 571 566 572 push( @result, '</p>' ) if $inParagraph; 567 573 $inParagraph = 0; 568 $line = '<p>'; 574 575 $line = '<p' . $class . '>'; 576 569 577 $this->_addListItem( \@result, '', '', '' ) if $inList; 570 578 $inList = 0; 579 571 580 $inParagraph = 1; 572 581 … … 661 670 $this->_addListItem( \@result, '', '', '' ) if $inList; 662 671 $inList = 0; 663 if ( $inParagraph and @result and $result[-1] !~ /<p >$/ ) {672 if ( $inParagraph and @result and $result[-1] !~ /<p(?: class='[^']+')?>$/ ) { 664 673 665 674 # This is the second (or later) line of a paragraph 666 675 667 676 my $whitespace = "\n"; 677 if ($line =~ m/^$TT1(\d+)$TT2/ 678 and $this->{refs}->[$1]->{text} =~ /^\n?%/ ) { 679 # The newline is already protected 680 $whitespace = ""; 681 } 668 682 if ( $line =~ s/^(\s+)// ) { 669 683 $whitespace .= $1; 670 684 } 671 $line = $this->_hideWhitespace($whitespace) . $line ;685 $line = $this->_hideWhitespace($whitespace) . $line if length($whitespace); 672 686 } 673 687 unless ( $inParagraph or $inDiv ) { -
trunk/WysiwygPlugin/test/unit/WysiwygPlugin/BrowserTranslatorTests.pm
r9886 r10527 136 136 %SEARCH{search="Sven"}% 137 137 HERE 138 finaltml => <<'HERE',139 ---140 141 %SEARCH{search="Sven"}%142 HERE143 138 html => <<'HERE', 144 139 <hr class="TMLhr" /> 145 <p >140 <p class="WYSIWYG_NBNL"> 146 141 <span class="WYSIWYG_PROTECTED"><br />%SEARCH{search="Sven"}%</span> 147 142 </p> -
trunk/WysiwygPlugin/test/unit/WysiwygPlugin/ExtendedTranslatorTests.pm
r9886 r10527 466 466 Before 467 467 </p> 468 <table border="1" cellpadding="0" cellspacing="1"><tr><th>L</th><th>C</th><th>R</th></tr><tr><td> A2</td><td style="text-align: center" class="align-center"> 2</td><td style="text-align: right" class="align-right"> 2</td></tr><tr><td> A3</td><td style="text-align: center" class="align-center"> 3</td><td style="text-align: left" class="align-left"> 3</td></tr><tr><td> A4-6</td><td> four</td><td> four</td></tr><tr><td>^</td><td> five</td><td> five</td></tr></table><p /><table border="1" cellpadding="0" cellspacing="1"><tr><td>^</td><td> six</td><td> six</td></tr></table>468 <table border="1" cellpadding="0" cellspacing="1"><tr><th>L</th><th>C</th><th>R</th></tr><tr><td> A2</td><td style="text-align: center" class="align-center"> 2</td><td style="text-align: right" class="align-right"> 2</td></tr><tr><td> A3</td><td style="text-align: center" class="align-center"> 3</td><td style="text-align: left" class="align-left"> 3</td></tr><tr><td> A4-6</td><td> four</td><td> four</td></tr><tr><td>^</td><td> five</td><td> five</td></tr></table><p class="WYSIWYG_NBNL"/><table border="1" cellpadding="0" cellspacing="1"><tr><td>^</td><td> six</td><td> six</td></tr></table> 469 469 <p>After</p> 470 470 HERE -
trunk/WysiwygPlugin/test/unit/WysiwygPlugin/TranslatorTests.pm
r10344 r10527 511 511 name => 'orderedList_Item1341', 512 512 html => <<'HERE', 513 <ol><li>Sushi</li><li>Banana</li></ol><p />514 <ol><li type="A">Sushi</li><li type="A">Banana</li></ol><p />515 <ol><li type="i">Sushi</li><li type="i">Banana</li></ol><p />516 <ol><li type="I">Sushi</li><li type="I">Banana</li></ol><p />513 <ol><li>Sushi</li><li>Banana</li></ol><p class="WYSIWYG_NBNL"/> 514 <ol><li type="A">Sushi</li><li type="A">Banana</li></ol><p class="WYSIWYG_NBNL"/> 515 <ol><li type="i">Sushi</li><li type="i">Banana</li></ol><p class="WYSIWYG_NBNL"/> 516 <ol><li type="I">Sushi</li><li type="I">Banana</li></ol><p class="WYSIWYG_NBNL"/> 517 517 <ol><li>Sushi</li><li type="A">Sushi</li><li type="i">Sushi</li></ol> 518 518 HERE … … 554 554 TML 555 555 html => <<'HTML', 556 <ul><li> </li><li>alpha</li><li> </li><li>beta</li><li> </li></ul><p /> 557 <ol><li> </li><li>charlie</li><li> </li></ol><p /> 556 <ul><li> </li><li>alpha</li><li> </li><li>beta</li><li> </li></ul> 557 <p class="WYSIWYG_NBNL"/> 558 <ol><li> </li><li>charlie</li><li> </li></ol> 559 <p class="WYSIWYG_NBNL"/> 558 560 <ol><li type="i">angel</li><li type="i"> </li></ol> 559 561 <p>blah</p> … … 1683 1685 Paraone', 1684 1686 html => '<ul><li>list</li></ul>Paraone', 1687 }, 1688 { 1689 name => 'blankLineAndParaAfterList', 1690 exec => $TML2HTML | $ROUNDTRIP, 1691 tml => ' * list 1692 1693 Paraone', 1694 html => '<ul><li>list' 1695 . '</li></ul><p class="WYSIWYG_NBNL">Paraone</p>', 1696 }, 1697 { 1698 name => 'blankLineAndParaWithLeadingSpacesAfterList', 1699 exec => $ROUNDTRIP, 1700 tml => <<'TML', 1701 * list 1702 1703 Paraone 1704 TML 1685 1705 }, 1686 1706 { … … 2690 2710 html => <<'HERE', 2691 2711 <hr class="TMLhr" /> 2692 <p >2712 <p class="WYSIWYG_NBNL"> 2693 2713 <span class="WYSIWYG_PROTECTED"><br />%SEARCH{search="Sven"}%</span> 2694 2714 </p>
Note: See TracChangeset
for help on using the changeset viewer.
