From: Geoffrey T. D. <da...@us...> - 2001-03-02 21:25:16
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv32349/lib Modified Files: Tag: release-1_2-branch stdlib.php Log Message: Fix for invalid HTML from doubly-indented list elements. This: ** Item used to generate "<ul><ul><li>Item</ul></ul>" which is invalid. Now we generate "<dl><dd><ul><li>Item</ul></dl>" which is valid. Index: stdlib.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/stdlib.php,v retrieving revision 1.21.2.2 retrieving revision 1.21.2.3 diff -C2 -r1.21.2.2 -r1.21.2.3 *** stdlib.php 2001/03/02 03:48:47 1.21.2.2 --- stdlib.php 2001/03/02 21:26:03 1.21.2.3 *************** *** 181,184 **** --- 181,189 ---- $retvar = ''; + if ($level > 10) { + // arbitrarily limit tag nesting + ExitWiki(gettext ("Nesting depth exceeded in SetHTMLOutputMode")); + } + if ($tagtype == ZERO_LEVEL) { // empty the stack until $level == 0; *************** *** 230,240 **** // we add the diff to the stack // stack might be zero ! while ($stack->cnt() < $level) { ! $retvar .= "<$tag>\n"; ! $stack->push($tag); ! if ($stack->cnt() > 10) { ! // arbitrarily limit tag nesting ! ExitWiki(gettext ("Stack bounds exceeded in SetHTMLOutputMode")); ! } } --- 235,262 ---- // we add the diff to the stack // stack might be zero ! if ($stack->cnt() < $level) { ! while ($stack->cnt() < $level - 1) { ! // This is a bit of a hack: ! // ! // We're not nested deep enough, and have to make up ! // some kind of block element to nest within. ! // ! // Currently, this can only happen for nested list ! // element (either <ul> <ol> or <dl>). What we used ! // to do here is to open extra lists of whatever ! // type was requested. This would result in invalid ! // HTML, since and list is not allowed to contain ! // another list without first containing a list ! // item. ("<ul><ul><li>Item</ul></ul>" is invalid.) ! // ! // So now, when we need extra list elements, we use ! // a <dl>, and open it with an empty <dd>. ! ! $retvar .= "<dl><dd>"; ! $stack->push('dl'); ! } ! ! $retvar .= "<$tag>\n"; ! $stack->push($tag); } |