1<?php
2// must be run within DokuWiki
3if(!defined('DOKU_INC')) die();
4
5if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
6require_once DOKU_PLUGIN.'syntax.php';
7
8/**
9 * All DokuWiki plugins to extend the parser/rendering mechanism
10 * need to inherit from this class
11 */
12class helper_plugin_alphalist extends dokuwiki_plugin
13{
14    function getMethods(){
15      $result = array();
16      $result[] = array(
17	'name'   => 'parse',
18	'desc'   => 'change dokuwiki syntax to html',
19	'params' => array('string' => 'string'),
20	'return' => array('content' => 'string'),
21      );
22      $result[] = array(
23	'name'   => 'plain',
24	'desc'   => 'convert dokuwiki syntax to plain text',
25	'params' => array('string' => 'string'),
26	'return' => array('plain' => 'string'),
27      );
28    }
29    function parse($string)
30    {
31	$info = array();
32	$rendered = p_render('xhtml',p_get_instructions($string),$info);
33
34	dbglog($string, 'alphalist helper::parse before');
35	dbglog($rendered, 'alphalist helper::parse after');
36
37	return $rendered;
38
39    }
40    function plain($string)
41    {
42	$doku_inline_tags = array('**', '//', "''", '<del>', '</del>', ']]');
43	$plain = str_replace($doku_inline_tags, '', $string);
44	$req_link = '/\[\[(.*?\|)?/';
45	$plain = preg_replace($req_link, '', $plain);
46
47	dbglog($string, 'alphalist helper::plain before');
48	dbglog(trim($plain), 'alphalist helper::plain after');
49
50	return trim($plain);
51    }
52}
53
54