Ejemplo n.º 1
0
 /**
  * Visit the list item.
  *
  * @param T_Text_ListItem $node
  */
 function visitTextListItem(T_Text_ListItem $node)
 {
     $this->xhtml .= EOL . '<li>' . $node->getContent($this->filter);
     $this->registerForPostMethod($node);
 }
Ejemplo n.º 2
0
    function testParsesARepeatedlyNestedList()
    {
        $type1 = T_Text_List::ORDERED;
        $type2 = T_Text_List::UNORDERED;
        $content = <<<CONTENT
          {$type1} Item #1
            {$type2} Item #2
            {$type2} Item #3
          {$type1} Item #4
          {$type1} Item #5
            {$type2} Item #6
            {$type2} Item #7
          {$type1} Item #8
CONTENT;
        $text = new T_Text_Plain($content);
        $expect = new T_Text_Plain();
        $expect->addChild($list = new T_Text_List($type1));
        $list->addChild($item = new T_Text_ListItem('Item #1'));
        $item->addChild($nest = new T_Text_List($type2));
        $nest->addChild(new T_Text_ListItem('Item #2'));
        $nest->addChild(new T_Text_ListItem('Item #3'));
        $list->addChild(new T_Text_ListItem('Item #4'));
        $list->addChild($item2 = new T_Text_ListItem('Item #5'));
        $item2->addChild($nest2 = new T_Text_List($type2));
        $nest2->addChild(new T_Text_ListItem('Item #6'));
        $nest2->addChild(new T_Text_ListItem('Item #7'));
        $list->addChild(new T_Text_ListItem('Item #8'));
        $text->accept(new T_Text_ListLexer());
        $this->assertEquals($expect, $text);
    }