From: Arne Heizmann Date: Sat, 7 Aug 2004 12:37:20 +0000 (+0000) Subject: Bugfix: produce valid XHTML even if user entered invalid '' / ''' mark-up. X-Git-Tag: 1.5.0alpha1~2480 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=96206ce09bfbab32e9db2e0704fe18c5edaace91;p=lhc%2Fweb%2Fwiklou.git Bugfix: produce valid XHTML even if user entered invalid '' / ''' mark-up. --- diff --git a/includes/Parser.php b/includes/Parser.php index 8a9ee6a17b..a0e8649dd4 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -923,9 +923,9 @@ class Parser $arr[$i] = "'''''"; } # Count the number of occurrences of bold and italics mark-ups. + # We are not counting sequences of five apostrophes. if (strlen ($arr[$i]) == 2) $numitalics++; else - if (strlen ($arr[$i]) == 3) $numbold++; else - if (strlen ($arr[$i]) == 5) { $numitalics++; $numbold++; } + if (strlen ($arr[$i]) == 3) $numbold++; } $i++; } @@ -1037,6 +1037,15 @@ class Parser } $i++; } + # Now close all remaining tags. Notice that the order is important. + if ($state == 'strong' || $state == 'emstrong') + $output .= ""; + if ($state == 'em' || $state == 'strongem' || $state == 'emstrong') + $output .= ""; + if ($state == 'strongem') + $output .= ""; + if ($state == 'both') + $output .= "{$buffer}"; return $output; } }