From a853d21d54cde97e1d1c68ddea40be7ca9e802c9 Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Sat, 29 Jan 2005 23:03:56 +0000 Subject: [PATCH] simplifications git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-412 --- include/wiki.inc.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/include/wiki.inc.php b/include/wiki.inc.php index 23a1595..83c0474 100644 --- a/include/wiki.inc.php +++ b/include/wiki.inc.php @@ -316,15 +316,15 @@ class XOrgWikiToText // {{{ function _render - function _render($AST, $idt, $list, $first) + function _render($AST, $idt, $list, $fst) { $res = ''; - if (strpos('|br|div|p|pre|h1|h2|h3|li|', "|{$AST->type}|")!==false && !$first) { + if (strpos('|br|div|p|pre|h1|h2|h3|li|', "|{$AST->type}|")!==false && !$fst) { $res .= "\n$idt"; } if ($AST->type == 'ol' || $AST->type == 'ul') { if ($list) { - $res .= "$idt"; + $res .= $idt; } else { $list = true; } @@ -343,15 +343,10 @@ class XOrgWikiToText return "[{$AST->attrs['src']}]"; } foreach ($AST->childs as $val) { - $first = false; - if (is_string($val)) { - $res .= $val; - } else { - $res .= $this->_render($val, $idt, $list, $first); - } + $fst = false; + $res .= is_string($val) ? $val : $this->_render($val, $idt, $list, $fst); } - if (strpos('|br|div|p|pre|h1|h2|h3|li|', "|{$AST->type}|")!==false) { - } elseif ($AST->type == 'u') { + if ($AST->type == 'u') { $res .= '_'; } elseif ($AST->type == 'em') { $res .= '/'; -- 2.1.4