1<?php
2/**
3 * Mediasyntax Plugin, preformatted block component: Mediawiki style italic text
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Thorsten Staerk
7 */
8class syntax_plugin_mediasyntax_italic extends DokuWiki_Syntax_Plugin
9{
10
11  function getType(){ return 'formatting'; }
12
13  function getSort(){ return 40; }
14
15  function connectTo($mode)
16  {
17    $this->Lexer->addSpecialPattern('\'\'',$mode,'plugin_mediasyntax_italic');
18  }
19
20  function handle($match, $state, $pos, Doku_Handler $handler)
21  {
22    return array($match, $state, $pos);
23  }
24
25  function render($mode, Doku_Renderer $renderer, $data)
26  {
27    GLOBAL $italic;
28    if($mode == 'xhtml')
29    {
30      if (!$italic) $renderer->doc .= "<i>";
31      else $renderer->doc .= "</i>";
32      if ($italic) $italic=false;
33      else $italic=true;
34    }
35    return false;
36  }
37}
38
39//Setup VIM: ex: et ts=4 enc=utf-8 :
40