1<?php 2/** 3 * Include plugin (locallink component) 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Michael Hamann <michael@content-space.de> 7 */ 8 9if (!defined('DOKU_INC')) die('must be used inside DokuWiki'); 10 11class syntax_plugin_include_locallink extends DokuWiki_Syntax_Plugin { 12 13 function getType() { 14 return 'formatting'; 15 } 16 17 function getSort() { 18 return 50; 19 } 20 21 function handle($match, $state, $pos, Doku_Handler &$handler) { 22 // this is a syntax plugin that doesn't offer any syntax, so there's nothing to handle by the parser 23 } 24 25 /** 26 * Displays a local link to an included page 27 * 28 * @author Michael Hamann <michael@content-space.de> 29 */ 30 function render($mode, Doku_Renderer &$renderer, $data) { 31 global $ID; 32 if ($mode == 'xhtml') { 33 /** @var Doku_Renderer_xhtml $renderer */ 34 list($hash, $name, $id) = $data; 35 // construct title in the same way it would be done for internal links 36 $default = $renderer->_simpleTitle($id); 37 $name = $renderer->_getLinkTitle($name, $default, $isImage, $id); 38 $title = $ID.' ↵'; 39 $renderer->doc .= '<a href="#'.$hash.'" title="'.$title.'" class="wikilink1">'; 40 $renderer->doc .= $name; 41 $renderer->doc .= '</a>'; 42 return true; 43 } 44 return false; 45 } 46} 47// vim:ts=4:sw=4:et: 48