Archive for November, 2010

Problem with the Creole Plugin in the Dokuwiki 20101107 “Anteater” release

When the upgrade occurred, a bunch of errors, such as:

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Doku_Renderer_metadata::section_edit' was given in /home/bilye3/public_html/dokuwikiStandard/inc/parserutils.php on line 419

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'Doku_Renderer_xhtml::section_edit' was given in /home/bilye3/public_html/dokuwikiStandard/inc/parserutils.php on line 555

would appear at the top of each page (sometimes multiple times).

After quite a bit of searching, the answer appears to be:

Comment out lines lines 67 – 72 of lib/plugins/creole/syntax/header.php (within the given dokuwiki installation), as follows:

if ($level <= $conf['maxseclevel']) { // $handler->_addCall('section_edit', array(
// $handler->status['section_edit_start'],
// $pos-1,
// $handler->status['section_edit_level'],
// $handler->status['section_edit_title']
// ), $pos);
$handler->status['section_edit_start'] = $pos;
$handler->status['section_edit_level'] = $level;
$handler->status['section_edit_title'] = $title;
}

Make sure you then

touch /conf/local.php

(within the given dokuwiki installation)
and the problem should be resolved.

This fix was provided here:
http://www.dokuwiki.org/plugin:creole
(see the bottom of the page)
and the cache touch issue was referenced here:
http://forum.dokuwiki.org/thread/6009
(once again, at the bottom of the page).

Here is a copy of the modified header.php for reference purposes:



*/

// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();

if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');

/**
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
*/
class syntax_plugin_creole_header extends DokuWiki_Syntax_Plugin {

function getInfo(){
return array(
'author' => 'Esther Brunner',
'email' => 'wikidesign@gmail.com',
'date' => '2007-02-09',
'name' => 'Creole Plugin, header component',
'desc' => 'Creole style headers',
'url' => 'http://wiki.splitbrain.org/plugin:creole',
);
}

function getType(){ return 'container'; }
function getPType(){ return 'block'; }
function getSort(){ return 49; }

function getAllowedTypes(){
return array('formatting', 'substition', 'disabled', 'protected');
}

function preConnect(){
$this->Lexer->addSpecialPattern(
'(?m)^[ \t]*=+[^\n]+=*[ \t]*$',
'base',
'plugin_creole_header'
);
}

function handle($match, $state, $pos, &$handler){
global $conf;

// get level and title
$title = trim($match);
if (($this->getConf('precedence') == 'dokuwiki')
&& ($title{strlen($title) - 1} == '=')){ // DokuWiki
$level = 7 - strspn($title, '=');
} else { // Creole
$level = strspn($title, '=');
}
if ($level < 1) $level = 1; elseif ($level > 5) $level = 5;
$title = trim($title, '=');
$title = trim($title);

if ($handler->status['section']) $handler->_addCall('section_close', array(), $pos);

if ($level <= $conf['maxseclevel']){ // $handler->_addCall('section_edit', array(
// $handler->status['section_edit_start'],
// $pos-1,
// $handler->status['section_edit_level'],
// $handler->status['section_edit_title']
// ), $pos);
$handler->status['section_edit_start'] = $pos;
$handler->status['section_edit_level'] = $level;
$handler->status['section_edit_title'] = $title;
}

$handler->_addCall('header', array($title, $level, $pos), $pos);

$handler->_addCall('section_open', array($level), $pos);
$handler->status['section'] = true;
return true;
}

function render($mode, &$renderer, $data){
return true;
}
}

//Setup VIM: ex: et ts=4 enc=utf-8 :

No Comments