2 namespace sfjp\Wiki\Processor;
3 class Auto extends Base {
4 public function process($text) {
7 if (preg_match('/\A#!\/\S+\/(?:env\s+)?(ada|asm|asw|bash|csh|perl|python|ruby|sh|tcsh|zsh|php)/',
9 $type = array_key_exists($match[1], $typemap) ? $typemap[$match[1]] : $match[1];
10 $p = new Code(array($type));
14 $p->setContext($this->getContext());
15 $p->setFormatter($this->getFormatter());
16 $this->formatted_text = $p->process($text)->getFormattedText();
17 if (!$this->hasContext("parent_processor"))
18 $this->formatted_text .= $this->getFormatter()->cleanup();