From e672d60008b52fa49408071c79b8186e39968013 Mon Sep 17 00:00:00 2001 From: mappu Date: Tue, 17 Jun 2014 18:21:51 +1200 Subject: [PATCH] fix previous --- rebuild.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rebuild.php b/rebuild.php index 3236845..2715390 100644 --- a/rebuild.php +++ b/rebuild.php @@ -121,9 +121,10 @@ function text2html($sz) { $splitInside = function($begin, $end, $sz) { $parts = explode($begin, $sz); if (count($parts) == 1) return [$sz]; + $ret = [$parts[0]]; - foreach($parts as $part) { - $inner = explode($end, $part, 2); + for($i = 1, $e = count($parts); $i !== $e; ++$i) { + $inner = explode($end, $parts[$i], 2); $ret = array_merge($ret, $inner); } return $ret; @@ -138,8 +139,7 @@ function text2html($sz) { }; $htmlSections = $splitInside('', '', $sz); - return $oddEven($htmlSections, $sectionFmt, $identity); - + return $oddEven($htmlSections, $identity, $sectionFmt); } function array_decimate($array, $total, $partno) {