Changeset 4940 for branches/Release01x00/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm
- Timestamp:
- 09/15/09 21:30:53 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note: See TracChangeset
for help on using the changeset viewer.
