--- textile.pm.orig Fri May 21 00:37:39 2004 +++ textile.pm Fri May 21 01:16:38 2004 @@ -83,13 +83,14 @@ # strip out line breaks within pre blocks for restoration later... $str =~ s|()(.+?)()|"\n\n".$1._savebreaks($2).$3."\n\n"|ges; - $str =~ s!(<(h[1-6]|p|pre|blockquote).*?>)(.+?)()!"\n\n".$1.$3.$4."\n\n"!ges; + $str =~ s!(<(h[1-6]|div|p|pre|blockquote|table|ol|dl|ul|menu|dir|center|form|fieldset|address|hr).*?>)(.+?)()!"\n\n".$1.$3.$4."\n\n"!ges; $str =~ s/\r//g; my @paras = split /\n{2,}/, $str; my $out = ''; my $in_pre = 0; + my $in_math = 0; my $no_fmt = 0; foreach my $para (@paras) { @@ -134,7 +135,8 @@ @lines = split /\n/, $para; } - $in_pre = 1 if $para =~ m|]|; + $in_pre = 1 if $para =~ m/]/; + $in_math = 1 if $para =~ m/]/; + $pb ||= 'p' if !$in_pre && !$no_fmt && $fmt !~ m/<(h[1-6]|div|p|pre|blockquote|table|ol|dl|ul|menu|dir|center|form|fieldset|address|hr)[ >]/; $out .= '<'. ($macros{$pb} || $pb) . ($ps ? qq{ class="$ps"} : '') . '>' if $pb; $out .= '

' if ($pb eq 'bq') && $fmt !~ m/]/; - if (!$in_pre && !$no_fmt) { + if (!$in_pre && !$no_fmt && !$in_math) { # final pass for encoding my $tokens = _tokenize($fmt); $fmt = ''; @@ -251,7 +253,8 @@ $out .= '' if $pb; $out .= "\n\n" if $pb || $no_fmt; - $in_pre = 0 if $para =~ m||; + $in_pre = 0 if $para =~ m/<\/pre>/; + $in_math = 0 if $para =~ m/<\/math>/; } $out =~ s/\n\n$//s;