1)); $lines = preg_split('/\s*?\n\s*/', $argstr); foreach ($lines as $line) { if (!$line) { continue; } $line = trim($line); // If lines ends with a '|', remove it if ($line[strlen($line)-1] == '|') { $line = substr($line, 0, -1); } if ($line[0] != '|') { trigger_error(sprintf(_("Line %s does not begin with a '|'."), $line), E_USER_WARNING); } else { $table->pushContent($this->_parse_row($line, $basepage)); } } return $table; } function _parse_row ($line, $basepage) { $brkt_link = "\\[ .*? [^]\s] .*? \\]"; $cell_content = "(?: [^[] | ".ESCAPE_CHAR."\\[ | $brkt_link )*?"; preg_match_all("/(\\|+) \s* ($cell_content) \s* (?=\\||\$)/x", $line, $matches, PREG_SET_ORDER); $row = HTML::tr(); foreach ($matches as $m) { $cell = $m[2]; if ($cell[0] == '=') { $cell = trim(substr($cell, 1)); $row->pushContent(HTML::th(TransformInline($cell, 2.0, $basepage))); } else { $row->pushContent(HTML::td(TransformInline($cell, 2.0, $basepage))); } } return $row; } } // $Log: not supported by cvs2svn $ // For emacs users // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: ?>