Beispiel #1
0
 function testParsesAnExternalLink()
 {
     $element = new T_Text_ExternalLink('**content**', 'url');
     $element->accept(new T_Text_EmphLexer());
     $expected = new T_Text_ExternalLink(null, 'url');
     $expected->addChild(new T_Text_Emph('content'));
     $this->assertEquals($expected, $element);
 }
 function testParsesAnExternalLink()
 {
     $element = new T_Text_ExternalLink('^2', 'url');
     $element->accept(new T_Text_SuperSubscriptLexer());
     $expected = new T_Text_ExternalLink(null, 'url');
     $expected->addChild(new T_Text_Superscript('2'));
     $this->assertEquals($expected, $element);
 }
Beispiel #3
0
 /**
  * Returns original formatted text.
  *
  * @return string  original formatting
  */
 function __toString()
 {
     $content = parent::__toString();
     return '!' . $this->getUrl() . ($content ? ' ' . $content : '') . '!';
 }
Beispiel #4
0
 /**
  * Visit external link.
  *
  * @param T_Text_ExternalLink $node
  */
 function visitTextExternalLink(T_Text_ExternalLink $node)
 {
     $escape = new T_Filter_Xhtml();
     $this->xhtml .= '<a class="' . $this->ext_link_class . '" href="' . $node->getUrl($escape) . '">';
     $this->xhtml .= $node->getContent($this->filter);
     $this->registerForPostMethod($node);
 }
Beispiel #5
0
 function testNoRecursiveLinkParsing()
 {
     $internal = new T_Text_InternalLink('[http://example.com content]', 'url');
     $i_expected = clone $internal;
     $external = new T_Text_ExternalLink('[http://example.com content]', 'url');
     $x_expected = clone $external;
     $internal->accept(new T_Text_LinkLexer());
     $external->accept(new T_Text_LinkLexer());
     $this->assertEquals($i_expected, $internal);
     $this->assertEquals($x_expected, $external);
 }
Beispiel #6
0
 function testExternalLinkRendersChildrenWithinCorrectTags()
 {
     $wiki = new T_Text_ExternalLink('parent', 'url');
     $wiki->addChild(new T_Text_Plain('child_one'));
     $wiki->addChild(new T_Text_Plain('child_two'));
     $this->assertSame('<a class="ext" href="url">parentchild_onechild_two</a>', $this->getVisitorRender($wiki));
 }