Beispiel #1
0
function handle_list(BBNode $node, BBCode $handler)
{
    $currentItem = null;
    $nodeChildren = $node->children;
    foreach ($nodeChildren as $child) {
        $validText = $child instanceof BBText && trim($child->text);
        // if the child is a list item, the following children (which are not list items) should be added to the child.
        if ($child instanceof BBTag && $child->tagName == '*') {
            $currentItem = $child;
        } else {
            if ($validText || !$child instanceof BBText) {
                if ($currentItem == null) {
                    // this means the first component of the list is not a list item
                    $currentItem = new BBTag('*');
                    array_unshift($node->children, $currentItem);
                    $currentItem->parent = $node;
                }
                $node->remove($child);
                $currentItem->add($child);
            }
        }
    }
    return '<ul class="bblist">' . $handler->dumper->dumpChildren($node) . '</ul>';
}
Beispiel #2
0
 function getUnparsed($noparse = FALSE)
 {
     $attrib = $this->_attrib ? '=' . $this->_attrib : '';
     return "[{$this->_tag}{$attrib}]" . parent::flatten($noparse) . "[/{$this->_tag}]";
 }