1<?php
2/**
3 * DokuWiki Syntax Plugin InlineJS EmbedBlock
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Satoshi Sahara <sahara.satoshi@gmail.com>
7 *
8 * @see also: https://www.dokuwiki.org/devel:javascript
9 *
10 * Allow inline JavaScript in DW page.
11 * Make sure that your script embedded inside of CDATA section.
12 *
13 * SYNTAX:
14 *         <JS>
15 *           ...
16 *         </JS>
17 */
18
19require_once(dirname(__FILE__).'/embedder.php');
20
21class syntax_plugin_inlinejs_embedblock extends syntax_plugin_inlinejs_embedder
22{
23    public function getType()
24    {   // Syntax Type
25        return 'protected';
26    }
27
28    public function getPType()
29    {   // Paragraph Type
30        return 'block';
31    }
32
33    /**
34     * Connect pattern to lexer
35     */
36    //protected $mode, $pattern;
37
38    public function preConnect()
39    {
40        // drop 'syntax_' from class name
41        $this->mode = substr(get_class($this), 7);
42
43        // syntax pattern
44        $this->pattern[1] = '<JS>(?=.*?</JS>)';
45        $this->pattern[4] = '</JS>';
46    }
47
48    /**
49     * Plugin features
50     */
51    //protected $code = null;
52
53}
54