====== A Renderer Plugin for DokuWiki ======
...which does not run :-(
I find it annoying that the quotation marks are hardcoded in DokuWiki's source code. At the moment, I have a workaround by abusing the [[doku>wiki:tpl:ach|ACH-Template]]:
Here ''wfModiOut()'' is a function, that consists mostly of those two lines:
$retval = str_replace('“', '»', $retval);
$retval = str_replace('”', '«', $retval);
I thought that a renderer plugin would replace this, and so I started to work around my workaround by the following code:
**/
// the following lines are stolen from the s5 plugin of Harry Fuecks and Andi Gohr
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
// we inherit from the XHTML renderer instead directly of the base renderer
require_once DOKU_INC.'inc/parser/xhtml.php';
// stolen code ends here
if (!defined('DOKU_PLUGIN'))
define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
require_once DOKU_PLUGIN . 'modirend/conf/default.php';
/**
This class allow to change the double and single quotation marks,
something I always wanted but what never got implemented.
Instead of modifying 4 lines in DokuWikis source code
I have to write a plugin :-(
**/
class Doku_Renderer_modirend extends Doku_Renderer_xhtml {
/**
Return some info
**/
function getInfo(){
return array(
'author' => 'Werner Flamme',
'email' => 'w.flamme@web.de',
'date' => '2007-01-13',
'name' => 'MODIfied RENDerer',
'desc' => 'Changes quote marks',
'url' => 'http://www.wernerflamme.name/users:wflamme:modirend',
);
} // function getInfo
/**
add opening single quote to document's code
**/
function singlequoteopening()
{
global $conf;
$this->doc .= $conf['modirend_sq_open'];
}
/**
add closing single quote to document's code
**/
function singlequoteclosing()
{
global $conf;
$this->doc .= $conf['modirend_sq_close'];
}
/**
add opening double quote to document's code
**/
function doublequoteopening()
{
global $conf;
$this->doc .= $conf['modirend_dq_open'];
}
/**
add closing double quote to document's code
**/
function doublequoteclosing()
{
global $conf;
$this->doc .= $conf['modirend_dq_close'];
}
}
//Setup VIM: ex: et ts=4 enc=utf-8 :
So I use the standard XHTML renderer of DokuWiki and overwrite 4 of its methods. When I append ''&do=export_modirend'' to the URL, I get "my" quotation marks (or when I use ''echo exportlink($ID, 'modirend');'' inside my template). This is the theory.
Practically, the ''&do=export_modirend'' leads to displaying the document's content only, without any XHTML headers and other things that make a page look nice ;-). Without my quotation marks. When I add some output to ''$conf[...]'', this additional Text appears.
Next, my Apache didn't show my pages correctly at all -- only fragments of them were shown, whether or not I added ''&do=export_modirend''. In the error log I only saw that Apache's child died unexpectedly (does Apache expect that the children die otherwise? ;-))
Question: why don't I get the expected result -- a text (or a page) looking exactly like the other one, except for the modified quotation marks? How can I use the renderer plugin correctly?