1<?php
2/**
3 *
4 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
5 * @author     Andreas Gohr <andi@splitbrain.org>
6 */
7// must be run within Dokuwiki
8if(!defined('DOKU_INC')) die();
9require_once(dirname(__FILE__).'/table.php');
10
11/**
12 * This inherits from the table syntax, because it's basically the
13 * same, just different output
14 */
15class syntax_plugin_semanticdata_list extends syntax_plugin_semanticdata_table {
16
17    /**
18     * Connect pattern to lexer
19     */
20    function connectTo($mode) {
21        $this->Lexer->addSpecialPattern('----+ *datalist(?: [ a-zA-Z0-9_]*)?-+\n.*?\n----+',$mode,'plugin_semanticdata_list');
22    }
23
24    protected $before_item = '<li><div class="li">';
25    protected $after_item  = '</div></li>';
26    protected $before_val  = '';
27    protected $after_val   = ' ';
28
29    /**
30     * Create output
31     */
32    function preList($clist, $data) {
33        return '<div class="dataaggregation"><ul class="dataplugin_list '.$data['classes'].'">';
34    }
35
36    function nullList($data, $clist, &$R) {
37        $R->doc .= '<div class="dataaggregation"><p class="dataplugin_list '.$data['classes'].'">';
38        $R->cdata($this->getLang('none'));
39        $R->doc .= '</p></div>';
40    }
41
42    function postList($data) {
43        return '</ul></div>';
44    }
45
46}
47