1<?php 2 3/** 4 * Include plugin sort order tag, idea and parts of the code copied from the indexmenu plugin. 5 * 6 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 7 * @author Samuele Tognini <samuele@netsons.org> 8 * @author Michael Hamann <michael@content-space.de> 9 * 10 */ 11class syntax_plugin_include_sorttag extends DokuWiki_Syntax_Plugin { 12 13 /** 14 * What kind of syntax are we? 15 */ 16 public function getType(){ 17 return 'substition'; 18 } 19 20 /** 21 * The paragraph type - block, we don't need paragraph tags 22 * 23 * @return string The paragraph type 24 */ 25 public function getPType() { 26 return 'block'; 27 } 28 29 /** 30 * Where to sort in? 31 */ 32 public function getSort(){ 33 return 139; 34 } 35 36 /** 37 * Connect pattern to lexer 38 */ 39 public function connectTo($mode) { 40 $this->Lexer->addSpecialPattern('{{include_n>.+?}}',$mode,'plugin_include_sorttag'); 41 } 42 43 /** 44 * Handle the match 45 */ 46 public function handle($match, $state, $pos, Doku_Handler $handler){ 47 $match = substr($match,12,-2); 48 return array($match); 49 } 50 51 /** 52 * Render output 53 */ 54 public function render($mode, Doku_Renderer $renderer, $data) { 55 if ($mode === 'metadata') { 56 /** @var Doku_Renderer_metadata $renderer */ 57 $renderer->meta['include_n'] = $data[0]; 58 } 59 } 60} 61