From: <var...@us...> - 2014-09-16 08:17:34
|
Revision: 9081 http://sourceforge.net/p/phpwiki/code/9081 Author: vargenau Date: 2014-09-16 08:17:23 +0000 (Tue, 16 Sep 2014) Log Message: ----------- Wicreole tables: better handle completely empty cells; allow COUNT in headers Modified Paths: -------------- trunk/lib/plugin/WikicreoleTable.php Modified: trunk/lib/plugin/WikicreoleTable.php =================================================================== --- trunk/lib/plugin/WikicreoleTable.php 2014-09-16 08:14:33 UTC (rev 9080) +++ trunk/lib/plugin/WikicreoleTable.php 2014-09-16 08:17:23 UTC (rev 9081) @@ -138,6 +138,8 @@ private function parse_row($line) { + $line = str_replace('|', ' |', $line); + $bracket_link = "\\[ .*? [^]\s] .*? \\]"; $cell_content = "(?: [^[] | " . ESCAPE_CHAR . "\\[ | $bracket_link )*?"; @@ -287,7 +289,11 @@ $counter++; } } - $result = $counter - 1; // exclude self + if (string_starts_with(trim($table[$i][$j]), "=")) { + $result = $counter; + } else { + $result = $counter - 1; // exclude self + } return str_replace("@@=COUNT(C)@@", $result, $table[$i][$j]); } elseif (strpos($table[$i][$j], "@@=COUNT(R)@@") !== false) { @@ -297,7 +303,11 @@ $counter++; } } - $result = $counter - 1; // exclude self + if (string_starts_with(trim($table[$i][$j]), "=")) { + $result = $counter; + } else { + $result = $counter - 1; // exclude self + } return str_replace("@@=COUNT(R)@@", $result, $table[$i][$j]); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |