11 public $elements = array(
'li' =>
true,
'ul' =>
true,
'ol' =>
true);
14 $this->whitespace =
false;
17 if (empty($tokens_of_children))
return false;
26 $all_whitespace =
true;
29 $need_close_li =
false;
31 foreach ($tokens_of_children as $token) {
32 if (!empty($token->is_whitespace)) {
36 $all_whitespace =
false;
38 if ($nesting == 1 && $need_close_li) {
41 $need_close_li =
false;
44 $is_child = ($nesting == 0);
53 if ($token->name ===
'li') {
56 } elseif ($token->name ===
'ul' || $token->name ===
'ol') {
58 $need_close_li =
true;
62 $result[] =
new HTMLPurifier_Token_Start(
'li');
67 if (
$t instanceof HTMLPurifier_Token_End) {
72 if (
$t->name !==
'li') {
73 trigger_error(
"Only li present invariant violated in List ChildDef", E_USER_ERROR);
78 if (
$t->name !==
'li') {
79 trigger_error(
"Only li present invariant violated in List ChildDef", E_USER_ERROR);
83 $result[] =
new HTMLPurifier_Token_Start(
'li',
$t->attr,
$t->line,
$t->col,
$t->armor);
86 if (!
$t->is_whitespace) {
87 trigger_error(
"Only whitespace present invariant violated in List ChildDef", E_USER_ERROR);
100 $result[] =
new HTMLPurifier_Token_Start(
'li');
103 $need_close_li =
true;
108 if ($need_close_li) {
111 if (empty(
$result))
return false;
112 if ($all_whitespace) {
115 if ($tokens_of_children ==
$result)
return true;