From fbb64ceb3e00d6d152f8c2aa15db4a2117b8e00d Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@1ca29b6e-896d-4ea0-84a5-967f57386b96> Date: Mon, 2 Oct 2006 13:14:14 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create tag 't1'. git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@399 1ca29b6e-896d-4ea0-84a5-967f57386b96 --- tags/t1/NP_Wtable/NP_Wtable.php | 118 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 tags/t1/NP_Wtable/NP_Wtable.php diff --git a/tags/t1/NP_Wtable/NP_Wtable.php b/tags/t1/NP_Wtable/NP_Wtable.php new file mode 100644 index 0000000..94746b5 --- /dev/null +++ b/tags/t1/NP_Wtable/NP_Wtable.php @@ -0,0 +1,118 @@ +currentItem =& $data["item"]; + + $this->currentItem->body = removeBreaks($this->currentItem->body); +// $this->currentItem->body = str_replace("\r\n", "\n", $this->currentItem->body); + $this->currentItem->body = preg_replace_callback("#\|(.*)\|\r\n#", array(&$this, 'list_table'), $this->currentItem->body); + $this->currentItem->body = preg_replace_callback("#\!(.*)\!#", array(&$this, 'convert_table'), $this->currentItem->body); + $this->currentItem->body = addBreaks($this->currentItem->body); + + $this->currentItem->more = preg_replace_callback("#\|(.*?)\|#", array(&$this, 'convert_table'), $this->currentItem->more); + } + + function list_table($text) + { + return "!" . $text[1] . "!"; + } + + function convert_table($text) + { + $rows = explode('!!', $text[1]); + for ($r =0; $r < count($rows); $r++) { + $cell = explode('|', $rows["$r"]); + for ($c = 0; $c < count($cell); $c++) { + $cols["$c"]["$r"] = $cell["$c"]; + } + } + + for ($c = 0; $c < count($cols); $c++) { + $cols["$c"] = array_reverse ($cols["$c"], TRUE); + $rowspan = 1; +// print_r($cols["$c"]); + foreach($cols["$c"] as $key => $val) { + if ($val == '~') { + $rowspan ++; + $row["$key"]["$c"] = $val; + } elseif($val == '>') { + $row["$key"]["$c"] = $val; + } elseif($rowspan > 1) { + $row["$key"]["$c"] = '