'substition' (i.e. 'substitution').
* @public
* @static
*/
function getType(){
return 'substition';
}
/**
* What kind of syntax do we allow (optional)
*/
// function getAllowedTypes() {
// return array();
// }
/**
* Define how this plugin is handled regarding paragraphs.
*
*
* This method is important for correct XHTML nesting. It returns
* one of the following values:
*
*
* - normal
- The plugin can be used inside paragraphs.
* - block
- Open paragraphs need to be closed before
* plugin output.
* - stack
- Special case: Plugin wraps other paragraphs.
*
* @param none
* @return String 'block'.
* @public
* @static
*/
// function getPType(){
// return 'normal';
// }
/**
* Where to sort in?
*
* @param none
* @return Integer 6.
* @public
* @static
*/
function getSort(){
return 999;
}
/**
* Connect lookup pattern to lexer.
*
* @param $aMode String The desired rendermode.
* @return none
* @public
* @see render()
*/
function connectTo($mode) {
$this->Lexer->addSpecialPattern('~~DOC~~',$mode,'plugin_docincluder');
// $this->Lexer->addEntryPattern('',$mode,'plugin_test');
}
// function postConnect() {
// $this->Lexer->addExitPattern('','plugin_test');
// }
/**
* Handler to prepare matched data for the rendering process.
*
*
* The $aState parameter gives the type of pattern
* which triggered the call to this method:
*
*
* - DOKU_LEXER_ENTER
* - a pattern set by addEntryPattern()
* - DOKU_LEXER_MATCHED
* - a pattern set by addPattern()
* - DOKU_LEXER_EXIT
* - a pattern set by addExitPattern()
* - DOKU_LEXER_SPECIAL
* - a pattern set by addSpecialPattern()
* - DOKU_LEXER_UNMATCHED
* - ordinary text encountered within the plugin's syntax mode
* which doesn't match any pattern.
*
* @param $aMatch String The text matched by the patterns.
* @param $aState Integer The lexer state for the match.
* @param $aPos Integer The character position of the matched text.
* @param $aHandler Object Reference to the Doku_Handler object.
* @return Integer The current lexer state for the match.
* @public
* @see render()
* @static
*/
function handle($match, $state, $pos, Doku_Handler $handler){
switch ($state) {
case DOKU_LEXER_ENTER :
break;
case DOKU_LEXER_MATCHED :
break;
case DOKU_LEXER_UNMATCHED :
break;
case DOKU_LEXER_EXIT :
break;
case DOKU_LEXER_SPECIAL :
break;
}
return array();
}
/**
* Handle the actual output creation.
*
*
* The method checks for the given $aFormat and returns
* FALSE when a format isn't supported. $aRenderer
* contains a reference to the renderer object which is currently
* handling the rendering. The contents of $aData is the
* return value of the handle() method.
*
* @param $aFormat String The output format to generate.
* @param $aRenderer Object A reference to the renderer object.
* @param $aData Array The data created by the handle()
* method.
* @return Boolean TRUE if rendered successfully, or
* FALSE otherwise.
* @public
* @see handle()
*/
function render($mode, Doku_Renderer $renderer, $data) {
if($mode == 'xhtml'){
$ID = cleanID(getID());
$text = strtr(noNS($ID),'_',' ');
$text2 = "template:doc:{$text}";
if (rawWiki($text2) == '') {
$renderer->doc .= $renderer->render_text($this->getLang('no_doc'), 'xhtml');
}
else {
$renderer->doc .= $renderer->render_text(rawWiki($text2), 'xhtml');
}
return true;
}
return false;
}
}