Changeset 4940
- Timestamp:
- 09/15/09 21:30:53 (2 years ago)
- Location:
- branches/Release01x00/WysiwygPlugin
- Files:
-
- 3 edited
-
lib/Foswiki/Plugins/WysiwygPlugin.pm (modified) (1 diff)
-
lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm (modified) (3 diffs)
-
test/unit/WysiwygPlugin/TranslatorTests.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/Release01x00/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin.pm
r4931 r4940 555 555 556 556 # Look for combinations of sticky and other markup that cause problems together 557 for my $tag (' verbatim', 'literal', keys %xmltag) {557 for my $tag ('literal', keys %xmltag) { 558 558 while ($text =~ /<$tag\b[^>]*>(.*?)<\/$tag>/gsi) { 559 559 my $inner = $1; -
branches/Release01x00/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm
r4294 r4940 36 36 37 37 use CGI qw( -any ); 38 use Error qw( :try ); 38 39 39 40 use Foswiki; … … 101 102 # Substitute back in protected elements 102 103 $content = $this->_dropBack($content); 104 105 if ($content =~ /[$TT0$TT1$TT2]/o) { 106 # There should never be any of these in the text at this point. 107 # If there are, then the conversion failed. 108 # Encode the original TML as verbatim-style HTML and include it 109 # in an error log, so that the user at least has a chance to save 110 # his/her work. 111 my $originalContent = $_[1]; 112 $originalContent =~ s/[$TT0$TT1$TT2]/?/go; 113 $originalContent = _protectVerbatimChars($originalContent); 114 $originalContent =~ s{/}{'&#'.ord('/').';'}ge; # </tag> looks like a path, but it isn't 115 throw Error::Simple( 'Conversion to HTML failed. TML:<br />'.$originalContent ); 116 } 103 117 104 118 # DEBUG … … 538 552 sub _protectVerbatimChars { 539 553 my $text = shift; 540 $text =~ s/([\000-\011\013-\037<&>'"])/'&#'.ord($1).';'/ges; 554 # $TT0, $TT1 and $TT2 are chr(0), chr(1) and chr(2), respectively. 555 # They are handled specially, elsewhere 556 $text =~ s/([\003-\011\013-\037<&>'"])/'&#'.ord($1).';'/ges; 541 557 $text =~ s/ / /g; 542 558 $text =~ s/\n/<br \/>/gs; -
branches/Release01x00/WysiwygPlugin/test/unit/WysiwygPlugin/TranslatorTests.pm
r4931 r4940 1652 1652 }, 1653 1653 { 1654 exec => $ ROUNDTRIP | $CANNOTWYSIWYG, # SMELL: Fix this case1654 exec => $HTML2TML | $ROUNDTRIP, 1655 1655 name => 'stickyInsideVerbatimItem1980', 1656 1656 tml => <<'GLUED', … … 2158 2158 2159 2159 my $txer = new Foswiki::Plugins::WysiwygPlugin::TML2HTML(); 2160 my $html = $txer->convert( 2161 $tml, 2162 $this->TML_HTMLconverterOptions() 2163 ); 2160 # This conversion can throw an exception. 2161 # This might be expected if $args->{exec} also has $CANNOTWYSIWYG set 2162 my $html = eval { 2163 $txer->convert( 2164 $tml, 2165 $this->TML_HTMLconverterOptions() 2166 ); 2167 }; 2168 $html = $@ if $@; 2164 2169 2165 2170 $txer = new Foswiki::Plugins::WysiwygPlugin::HTML2TML();
Note: See TracChangeset
for help on using the changeset viewer.
