Exemplo n.º 1
0
 function testParagraphRendersChildrenWithinCorrectTags()
 {
     $wiki = new T_Text_Paragraph('parent');
     $wiki->addChild(new T_Text_Plain('child_one'));
     $wiki->addChild(new T_Text_Plain('child_two'));
     $this->assertSame(EOL . '<p>parentchild_onechild_two</p>', $this->getVisitorRender($wiki));
 }
Exemplo n.º 2
0
 function testHandlesParagraphThatModifiesOriginalFilter()
 {
     $wiki = new T_Text_Paragraph('some content');
     $wiki->addChild(new T_Text_Plain('more content'));
     $short = new T_Text_Paragraph('some content');
     $short->addChild(new T_Text_Plain('more ...'));
     $test = new T_Xhtml_TextPreview(20, $this->getRootUrl());
     $ref = new T_Xhtml_Text($this->getRootUrl());
     $this->assertSame($this->getVisitorRender($short, $ref), $this->getVisitorRender($wiki, $test));
 }
Exemplo n.º 3
0
 function testParsesAParagraph()
 {
     $element = new T_Text_Paragraph('**content**');
     $element->accept(new T_Text_EmphLexer());
     $expected = new T_Text_Paragraph();
     $expected->addChild(new T_Text_Emph('content'));
     $this->assertEquals($expected, $element);
 }
Exemplo n.º 4
0
 function testParsesAParagraph()
 {
     $element = new T_Text_Paragraph('^2');
     $element->accept(new T_Text_SuperSubscriptLexer());
     $expected = new T_Text_Paragraph();
     $expected->addChild(new T_Text_Superscript('2'));
     $this->assertEquals($expected, $element);
 }
Exemplo n.º 5
0
 /**
  * Visit the paragraph mode.
  *
  * @param T_Text_Paragraph $node
  */
 function visitTextParagraph(T_Text_Paragraph $node)
 {
     // inside a paragraph, all newlines should be converted to <br /> tags.
     $this->f_swap_space = $this->filter;
     $this->filter = new T_Filter_EolToBr($this->filter);
     // render content
     $this->xhtml .= EOL . '<p>' . $node->getContent($this->filter);
     $this->registerForPostMethod($node);
 }
Exemplo n.º 6
0
 function testParsesAParagraph()
 {
     $element = new T_Text_Paragraph('[http://example.com content]');
     $element->accept(new T_Text_LinkLexer());
     $expected = new T_Text_Paragraph();
     $expected->addChild(new T_Text_ExternalLink('content', 'http://example.com'));
     $this->assertEquals($expected, $element);
 }
Exemplo n.º 7
0
 function testThatChildrenOfParagraphNotParsed()
 {
     $element = new T_Text_Paragraph("para1\n\n\npara2");
     $element->addChild(new T_Text_Plain("nested1\n\nnested2"), 'nest');
     $element->accept(new T_Text_ParagraphLexer());
     $this->assertSame("nested1\n\nnested2", $element->nest->getContent());
 }