OSDN Git Service

Import current code.
[osdn-codes/wiki-parser.git] / sfjp / wiki / processor / code.php
1 <?php
2 namespace sfjp\Wiki\Processor;
3 require_once 'include/general/syntax-highlight.php';
4 class Code extends Base {
5         public function process($text) {
6                 $this->setText($text);
7                 $lang = $this->getArgs(0);
8                 $fmt = $this->getFormatter();
9                 $ret = $fmt->raw_node(highlight_syntax(trim($text, "\r\n"), $lang));
10                 if (!$this->hasContext("parent_processor"))
11                         $ret .= $this->getFormatter()->cleanup();
12                 $this->formatted_text = $ret;
13                 return $this;
14         }
15 }