syntax_plugin_shy.php - A PHP4 class that implements
* a DokuWiki plugin for so-called 'soft hyphens'.
*
*
* Usage:
* \\-
* to insert a so-called "soft hyphen".
*
* Copyright (C) 2007, 2010 M.Watermann, D-10247 Berlin, FRG
* All rights reserved
* EMail : <support@mwat.de>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either
*
version 3 of the
* License, or (at your option) any later version.
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* @author Matthias Watermann
* @version $Id: syntax_plugin_shy.php,v 1.4 2010/02/22 10:49:59 matthias Exp $
* @since created 05-Jan-2007
*/
class syntax_plugin_shy extends DokuWiki_Syntax_Plugin {
/**
* @publicsection
*/
//@{
/**
* Tell the parser whether the plugin accepts syntax mode
* $aMode within its own markup.
*
* @param $aMode String The requested syntaxmode.
* @return Boolean FALSE always.
* @public
* @see getAllowedTypes()
*/
function accepts($aMode) {
return FALSE;
} // accepts()
/**
* Connect lookup pattern to lexer.
*
* @param $aMode String The desired rendermode.
* @public
* @see render()
*/
function connectTo($aMode) {
// Only match markup inside words:
$this->Lexer->addSpecialPattern('(?
* The returned array holds the following fields:
*
* - author
- Author of the plugin
* - email
- Email address to contact the author
* - date
- Last modified date of the plugin in
* YYYY-MM-DD format
* - name
- Name of the plugin
* - desc
- Short description of the plugin (Text only)
* - url
- Website with more information on the plugin
* (eg. syntax description)
*
* @return Array Information about this plugin class.
* @public
* @static
*/
function getInfo() {
return array(
'author' => 'Matthias Watermann',
'email' => 'support@mwat.de',
'date' => '2010-02-22',
'name' => 'Soft Hyphen Syntax Plugin',
'desc' => 'Include soft hyphens in wiki pages.',
'url' => 'http://www.dokuwiki.org/plugin:shy');
} // getInfo()
/**
* Where to sort in?
*
* @return Integer 176.
* @public
* @static
*/
function getSort() {
return 176;
} // getSort()
/**
* Get the type of syntax this plugin defines.
*
* @return String 'substition' (i.e. 'substitution').
* @public
* @static
*/
function getType() {
return 'substition'; // sic! should be __substitution__
} // getType()
/**
* Handler to prepare matched data for the rendering process.
*
*
* The $aState parameter gives the type of pattern
* which triggered the call to this method.
*
* @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 given $aState value.
* @public
* @see render()
* @static
*/
function handle($aMatch, $aState, $aPos, &$aHandler) {
return $aState; // nothing more to do here ...
} // handle()
/**
* 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 Integer The state value returned by handle().
* @return Boolean TRUE always.
* @public
* @see handle()
*/
function render($aFormat, &$aRenderer, &$aData) {
if (DOKU_LEXER_SPECIAL == $aData) {
// No test of '$aFormat' needed here:
// The raw UTF-8 character sequence is the same anyway.
$aRenderer->doc .= chr(194) . chr(173);
} // if
return TRUE;
} // render()
//@}
} // class syntax_plugin_shy
} // if
?>