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, &$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, &$renderer, $data) { 31 if ($mode == 'xhtml') { 32 /** @var Doku_Renderer_xhtml $renderer */ 33 list($hash, $name) = $data; 34 global $ID; 35 $name = $renderer->_getLinkTitle($name, $hash, $isImage); 36 $title = $ID.' ↵'; 37 $renderer->doc .= '<a href="#'.$hash.'" title="'.$title.'" class="wikilink1">'; 38 $renderer->doc .= $name; 39 $renderer->doc .= '</a>'; 40 return true; 41 } 42 return false; 43 } 44} 45// vim:ts=4:sw=4:et: 46