Render a page local link
public locallink ( string $hash, string $name = null, boolean $returnonly = false ) : void | string | ||
$hash | string | hash link identifier |
$name | string | name for the link |
$returnonly | boolean | whether to return html or write to doc attribute |
리턴 | void | string | writes to doc attribute or returns html depends on $returnonly |
/** * Produced by syntax like [[#test|my caption]] */ function test_empty_locallink_with_caption() { $page = 'my:spacex'; $caption = 'my caption'; global $ID; $ID = $page; global $conf; $conf['basedir'] = '/'; $conf['useheading'] = 0; $conf['userewrite'] = 0; $conf['useslash'] = 0; $conf['canonical'] = 0; $p = new Doku_Renderer_xhtml(); $p->locallink('test', $caption); $expect = '<a href="#test" title="' . $page . ' ↵" class="wikilink1">' . $caption . '</a>'; $this->assertEqual($p->doc, $expect); }