more && $this->from < 0 && $this->more = preg_match('/\[\!([^\r\n]+)?(([\r\n]+([^\!\n\r]+|\![^\]])*?)*)[\r\n]+\!\]/', $string, $this->matches, PREG_OFFSET_CAPTURE) ) $this->from = $this->matches[0][1]; } public function process($string, $modules, $level){ $formatted = \WMarkDown\Modules::format($this->wmarkdown, $data = $this->wmarkdown->load_file($this->matches[1][0]), [], $modules, $modules->menu_level); $head = ''; $body = ''; $foot = ''; $wmarkdown = $this->wmarkdown; preg_replace_callback('/^\|([\^_\-\#])?([^\r\n]+)/m', function($values) use(&$head, &$body, &$foot, $wmarkdown, $modules){ $html = ''; $block = in_array($values[1], ["^", "-"]) ? "head" : (in_array($values[1], ["_"]) ? "foot" : (in_array($values[1], ["#"]) ? "both" : "body")); $tag = $block == "body" ? "d" : "h"; preg_replace_callback('/(\|(\|+)?)?([^\|]+)/', function($cell) use(&$html, $tag, $wmarkdown, $modules){ $html .= '' . \WMarkDown\Modules::format($wmarkdown, trim($cell[3]), ["paragraphs"], $modules)["content"] . ''; }, $values[2]); $html = '' . $html . ''; if($block == "head") $head .= $html; elseif($block == "foot") $foot .= $html; elseif($block == "both"){ $head .= $html; $foot .= $html; }else $body .= $html; }, trim($this->matches[2][0])); $this->html = 'matches[1][0] ?? '', " class=\"") !== false ? preg_replace('/( class=\"[^"]+)/', "$1 wmd-table", $attributes) : $attributes . ' class="wmd-table"') . '>' . ( ($head ? '' . $head . '' : '') . ($body ? '' . $body . '' : '') . ($foot ? '' . $foot . '' : '') ) . ''; $this->length = strlen($this->matches[0][0]); $this->to = $this->from + $this->length; $this->content = $this->matches[1][0]; } };