|
From: Geoffrey T. D. <da...@us...> - 2001-03-02 21:14:39
|
Update of /cvsroot/phpwiki/phpwiki/lib
In directory usw-pr-cvs1:/tmp/cvs-serv27561/lib
Modified Files:
transform.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: transform.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/transform.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** transform.php 2001/03/02 00:24:17 1.18
--- transform.php 2001/03/02 21:16:05 1.19
***************
*** 110,113 ****
--- 110,118 ----
$retvar = '';
+ if ($level > 10) {
+ // arbitrarily limit tag nesting
+ ExitWiki(gettext ("Lists nested too deep in SetHTMLOutputMode"));
+ }
+
if ($level <= $this->stack->cnt()) {
// $tag has fewer nestings (old: tabs) than stack,
***************
*** 139,149 ****
// we add the diff to the stack
// stack might be zero
! while ($this->stack->cnt() < $level) {
$retvar .= StartTag($tag, $args) . "\n";
$this->stack->push($tag);
- if ($this->stack->cnt() > 10) {
- // arbitrarily limit tag nesting
- ExitWiki(gettext ("Stack bounds exceeded in SetHTMLOutputMode"));
- }
}
}
--- 144,169 ----
// we add the diff to the stack
// stack might be zero
! if ($this->stack->cnt() < $level) {
! while ($this->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>";
! $this->stack->push('dl');
! }
!
$retvar .= StartTag($tag, $args) . "\n";
$this->stack->push($tag);
}
}
|