Revision history for SimpleTables
Revision [23376]
Last edited on 2016-05-20 07:38:47 by DarTar [Replaces old-style internal links with new pipe-split links.]Additions:
<<==Note== This feature is under development and can be tested using the [[WikkaSVN | SVN trunk version]]. Note that the syntax for tables is likely to change until a stable version is released. Please do not invest much time in creating (advanced) tablemarkup yet!
~- [[Docs:TableMarkup | Table markup guide]]
~- [[Docs:TableMarkupReference | Table markup reference]]
~- For the latest version, download the latest [[WikkaUnstable | Wikka unstable version]].
~- [[Docs:TableMarkup | Table markup guide]]
~- [[Docs:TableMarkupReference | Table markup reference]]
~- For the latest version, download the latest [[WikkaUnstable | Wikka unstable version]].
Deletions:
~- [[Docs:TableMarkup Table markup guide]]
~- [[Docs:TableMarkupReference Table markup reference]]
~- For the latest version, download the latest [[WikkaUnstable Wikka unstable version]].
Additions:
~- [[Docs:TableMarkupReference Table markup reference]]
Deletions:
Additions:
<<>>==Documentation==
~- [[Docs:TableMarkup Table markup guide]]
~- [[Docs: TableMarkupReference Table markup reference]]
~- For more information, see Ticket:230.
==See also==
~- [[Docs:TableMarkup Table markup guide]]
~- [[Docs: TableMarkupReference Table markup reference]]
~- For more information, see Ticket:230.
==See also==
Deletions:
==Test at==
~- [[http://wiki.tormodh.net/SandBox more examples]]
~- For more information, please see Ticket:230.
Additions:
<<==Note== This feature is under development and can be tested using the [[WikkaSVN SVN trunk version]]. Note that the syntax for tables is likely to change until a stable version is released. Please do not invest much time in creating (advanced) tablemarkup yet!
~- To be included in 1.1.7.
~- For the latest version, download the latest [[WikkaUnstable Wikka unstable version]].
~- For more information, please see Ticket:230.
~- To be included in 1.1.7.
~- For the latest version, download the latest [[WikkaUnstable Wikka unstable version]].
~- For more information, please see Ticket:230.
Deletions:
''2006-06-21''
Patch committed to the SVN repository - to be included in ##1.1.6.3##:
~-Ticket:230
~-Changesets: [[http://wush.net/trac/wikka/changeset/129 129]], [[http://wush.net/trac/wikka/changeset/131 131]], [[http://wush.net/trac/wikka/changeset/132 132]]
Patched files:
~-##[[http://wush.net/trac/wikka/browser/trunk/css/wikka.css?rev=132&format=raw css/wikka.css]]##
~-##[[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=132&format=raw formatters/wakka.php]]##
Additions:
~- [[http://wiki.tormodh.net/SandBox more examples]]
Deletions:
Additions:
~- ++[[http://debug.wikkawiki.org/wikka.php?wakka=SimpleTablesSandBox more examples]] ''You must create an account to access, invite code is 'demo' ''++ Temporarily offline
Deletions:
Revision [20119]
Edited on 2008-07-09 02:55:34 by TormodHaugen [Removed link to my wiki, as it is down.]Deletions:
No Differences
Additions:
<<==Note== This feature is under development and can be tested using the SVN version. Note that the syntax for tables is likely to change until a stable version is released. Please do not invest much time in creating (advanced) tablemarkup yet!
<<>>==See also==
>>::c::
<<>>==See also==
>>::c::
Deletions:
**NOTE! Markup for tables are subject to change. Please do not invest much time in creating (advanced) tablemarkup yet!**
Additions:
**NOTE! Markup for tables are subject to change. Please do not invest much time in creating (advanced) tablemarkup yet!**
Revision [14670]
Edited on 2006-06-22 07:21:38 by DarTar [adding link to test server with complex table examples]Additions:
~- [[http://debug.wikkawiki.org/wikka.php?wakka=SimpleTablesSandBox more examples]]
Deletions:
==Patches for download==
It seems as if there might be some trouble with ''grab''bing and patching the code; these files are tested against the 1.1.6.2 download and should work:
~- [[http://temp.tormodh.net/simpletables.patch simpletables.patch]]
~- [[http://temp.tormodh.net/simpletables_css.patch simpletables_css.patch]]
Patches are for ''Wikka Wakka Wiki 1.1.6.2''. Should be easy to implement manually (or fuzzy) for other versions.
To pach a file under Linux; put the patch file in the same directory as the file itself and run with the command:
%%patch -p0 -l < patch_name.patch%%
Revert (uninstall ;)) with the command:
%%patch -p0 -l -R < patch_name.patch%%
**Save as ''simpletables.patch'' in ''./formatters/'' and apply from there (or do it manually).**
%%(php)
--- wakka.php.orig 2006-06-14 18:42:49.000000000 +0200
+++ wakka.php 2006-06-14 18:42:55.000000000 +0200
@@ -26,6 +26,7 @@
static $indentClosers = array();
static $newIndentSpace= array();
static $br = 1;
+ static $trigger_table = 0;
static $trigger_bold = 0;
static $trigger_italic = 0;
static $trigger_underline = 0;
@@ -48,6 +49,9 @@
if ((!is_array($things)) && ($things == 'closetags'))
{
+ if (2 < $trigger_table) echo ('</th></tr>');
+ else if (1 < $trigger_table) echo ('</td></tr>');
+ if (0 < $trigger_table) echo ('</table>');
if ($trigger_strike % 2) echo ('</span>');
if ($trigger_notes % 2) echo ('</span>');
if ($trigger_inserted % 2) echo ('</span>');
@@ -59,11 +63,68 @@
if ($trigger_bold % 2) echo('</strong>');
for ($i = 1; $i<=5; $i ++)
if ($trigger_l[$i] % 2) echo ("</h$i>");
- $trigger_bold = $trigger_center = $trigger_floatl = $trigger_inserted = $trigger_deleted = $trigger_italic = $trigger_keys = 0;
+ $trigger_bold = $trigger_center = $trigger_floatl = $trigger_inserted = $trigger_deleted = $trigger_italic = $trigger_keys = $trigger_table = 0;
$trigger_l = array(-1, 0, 0, 0, 0, 0);
$trigger_monospace = $trigger_notes = $trigger_strike = $trigger_underline = 0;
return;
}
+ if ( preg_match("/^\|(\?)(.*?)?\|(\n)?$/", $thing, $matches) ) {
+ if ( $trigger_table == 0 ) {
+ $trigger_table = 1;
+ //TODO escape text for safety
+ return '<table class="wikka" summary="'.$matches[2].'">'."\n";
+ }
+ }
+ // table. trigger means: 0==no table, 1==in table no cell, 2==in table data cell, 3==in table header cell
+ else if ( preg_match("/^\|(=|!)?(\d*)?(?:,)?(\d*)?\|(\n)?$/", $thing, $matches) ) {
+ //First catch is header|caption|summary, second is colspan, third is rowspan, fourth is linebreak.
+ if ( $trigger_table == 0 )
+ {
+ $rs = "<table class=\"wikka\">\n";
+ if ($matches[1] == "!") {
+ $trigger_table = 4;
+ return $rs."<caption>";
+ } else {
+ $rs .= "<tr>";
+ }
+ }
+ else if ( $trigger_table == 1 ) {
+ if ($matches[1] == "!") {
+ $trigger_table = 4;
+ return "<caption>";
+ } else {
+ $rs = "<tr>";
+ }
+ }
+ else if ( $trigger_table == 2 ) $rs = "</td>";
+ else if ( $trigger_table == 3 ) $rs = "</th>";
+ else if ( $trigger_table == 4 ) {
+ $trigger_table = 1;
+ return "</caption>\n";
+ }
+
+ if ( $trigger_table > 1 && $matches[4] == "\n") {
+ $trigger_table = 1;
+ return $rs."</tr>\n";
+ }
+
+ if ( $matches[1] == "=" ) {
+ $trigger_table = 3;
+ $rs .= "<th";
+ } else if ( $matches[1] == "" ) {
+ $trigger_table = 2;
+ $rs .= "<td";
+ }
+ if ( $matches[2] && $matches[2] > 1 ) $rs .= " colspan=\"$matches[2]\"";
+ if ( $matches[3] && $matches[3] > 1 ) $rs .= " rowspan=\"$matches[3]\"";
+
+ return $rs.">";
+
+ } else if ( $trigger_table == 1 ) {
+ //Are in table, no cell - but not asked to open new: please close and parse again. ;)
+ $trigger_table = 0;
+ return "</table>\n".wakka2callback($things);
+ }
// convert HTML thingies
if ($thing == "<")
return "<";
@@ -414,6 +475,7 @@
"\*\*|\'\'|\#\#|\#\%|@@|::c::|\>\>|\<\<|££|¥¥|\+\+|__|<|>|\/\/|". # Wiki markup
"======|=====|====|===|==|". # headings
"\n([\t~]+)(-|&|[0-9a-zA-Z]+\))?|". # indents and lists
+ "\|[^\|]*?\|(?:\n)?|". # Simple Tables
"\{\{.*?\}\}|". # action
"\b[A-ZÄÖÜ][A-Za-zÄÖÜßäöü]+[:](?![=_])\S*\b|". # InterWiki link
"\b([A-ZÄÖÜ]+[a-zßäöü]+[A-Z0-9ÄÖÜ][A-Za-z0-9ÄÖÜßäöü]*)\b|". # CamelWords
%%
**Save as ''simpletables_css.patch'' in ''./css/'' and apply from there (or do it manually).**
%%(css)
--- wikka.css.orig 2006-06-14 18:48:36.000000000 +0200
+++ wikka.css 2006-06-14 18:54:27.000000000 +0200
@@ -446,6 +446,11 @@
border-spacing: 0;
}
+table.wikka th {
+ border: 1px solid #CCC;
+ padding: .1em .25em;
+}
+
table.wikka td {
border: 1px solid #CCC;
padding: .1em .25em;
@@ -600,4 +605,4 @@
.toolbar .btn-active,
.toolbar .btn-pressed { border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; }
.toolbar .btn-pressed { background: ButtonHighlight; }
-.editornamecss { background-color:#CCCCFF; font-size: 18px; padding: 0 10px; }
\ No newline at end of file
+.editornamecss { background-color:#CCCCFF; font-size: 18px; padding: 0 10px; }
%%
Please comment / tell me of any suggestions. --TormodHaugen
Revision [14659]
Edited on 2006-06-21 07:42:48 by DarTar [updating SVN info, syntax description and examples]Additions:
~- [[http://wiki.tormodh.net/SandBox my testwiki]] running ##trunk## install with all SimpleTables features.
''2006-06-21''
Patch committed to the SVN repository - to be included in ##1.1.6.3##:
~-Changesets: [[http://wush.net/trac/wikka/changeset/129 129]], [[http://wush.net/trac/wikka/changeset/131 131]], [[http://wush.net/trac/wikka/changeset/132 132]]
~-##[[http://wush.net/trac/wikka/browser/trunk/css/wikka.css?rev=132&format=raw css/wikka.css]]##
~-##[[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=132&format=raw formatters/wakka.php]]##
I've hacked together a simple table markup for WikkaWiki; it is working it's way from a "layout" table markup to an accessible data table markup.
Currently it supports table header elements (##<th>##) and table data elements (##<td>##), cells spanning several columns and/or rows, table summary and caption, ##scope## attributes for headers, table sections (##<thead>, <tbody>, <tfoot>##).
**Example:**
##""||Row 1 Column 1||Row 1 Column 2||Row 1 Column 3||""
""||Row 2 Column 1||Row 2 Column 2||Row 2 Column 3||""##
**Example:**
##""|?This is a token summary, must be first line in table markup. PS is between single pipes!|""
""|#h|""
""|#b|""
""|#f|""
""|=|First Column|=|Second Column||""##
~- An optional caption for the table can be put behind a exclamation mark'ed delimiter (''""|!|""'') and a normal delimiter. ''Needs to be alone on the line!''
~-Optional ##row## and ##col## scope attributes for headers can be added as ''""|=r|""'' and ''""|=c|""''.
~-Optional ##thead##, ##tbody## and ##tfoot## sections are generated by adding on a separate line ''""|#h|""'', ''""|#b|""'', ''""|#f|""''
~- ++th scope attribute++ Done.
~- ++thead/tbody/tfoot++ Done.
''2006-06-21''
Patch committed to the SVN repository - to be included in ##1.1.6.3##:
~-Changesets: [[http://wush.net/trac/wikka/changeset/129 129]], [[http://wush.net/trac/wikka/changeset/131 131]], [[http://wush.net/trac/wikka/changeset/132 132]]
~-##[[http://wush.net/trac/wikka/browser/trunk/css/wikka.css?rev=132&format=raw css/wikka.css]]##
~-##[[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=132&format=raw formatters/wakka.php]]##
I've hacked together a simple table markup for WikkaWiki; it is working it's way from a "layout" table markup to an accessible data table markup.
Currently it supports table header elements (##<th>##) and table data elements (##<td>##), cells spanning several columns and/or rows, table summary and caption, ##scope## attributes for headers, table sections (##<thead>, <tbody>, <tfoot>##).
**Example:**
##""||Row 1 Column 1||Row 1 Column 2||Row 1 Column 3||""
""||Row 2 Column 1||Row 2 Column 2||Row 2 Column 3||""##
**Example:**
##""|?This is a token summary, must be first line in table markup. PS is between single pipes!|""
""|#h|""
""|#b|""
""|#f|""
""|=|First Column|=|Second Column||""##
~- An optional caption for the table can be put behind a exclamation mark'ed delimiter (''""|!|""'') and a normal delimiter. ''Needs to be alone on the line!''
~-Optional ##row## and ##col## scope attributes for headers can be added as ''""|=r|""'' and ''""|=c|""''.
~-Optional ##thead##, ##tbody## and ##tfoot## sections are generated by adding on a separate line ''""|#h|""'', ''""|#b|""'', ''""|#f|""''
~- ++th scope attribute++ Done.
~- ++thead/tbody/tfoot++ Done.
Deletions:
''2006-06-20''
This patch has been committed to the SVN repository and will be included in ##1.1.6.3##:
~-Changesets: [[http://wush.net/trac/wikka/changeset/129 129]], [[http://wush.net/trac/wikka/changeset/131 131]]
~-##[[http://wush.net/trac/wikka/browser/trunk/css/wikka.css?rev=131&format=raw css/wikka.css]]##
~-##[[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=131&format=raw formatters/wakka.php]]##
I've hacked together a simple table markup for WikkaWiki; it is working it's way from a "layout" table markup to a data table markup.
Currently it supports table header elements (<th>) and table data elements (<td>), cells spanning several columns and/or rows, table summary and caption.
Example (''is not in use, cannot be demonstrated here''):
""||Row 1 Column 1||Row 1 Column 2||Row 1 Column 3||""
""||Row 2 Column 1||Row 2 Column 2||Row 2 Column 3||""
Example (''is not in use, cannot be demonstrated here''):
""|?This is a token summary, must be first line in table markup. PS is between single pipes!|""
~- A caption for the table can be put behind a exclamation mark'ed delimiter (''""|!|""'') and a normal delimiter. ''Needs to be alone on the line!''
Additions:
''2006-06-20''
~-Ticket:230
~-Changesets: [[http://wush.net/trac/wikka/changeset/129 129]], [[http://wush.net/trac/wikka/changeset/131 131]]
~-##[[http://wush.net/trac/wikka/browser/trunk/css/wikka.css?rev=131&format=raw css/wikka.css]]##
~-##[[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=131&format=raw formatters/wakka.php]]##
~-Ticket:230
~-Changesets: [[http://wush.net/trac/wikka/changeset/129 129]], [[http://wush.net/trac/wikka/changeset/131 131]]
~-##[[http://wush.net/trac/wikka/browser/trunk/css/wikka.css?rev=131&format=raw css/wikka.css]]##
~-##[[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=131&format=raw formatters/wakka.php]]##
Deletions:
~-[[Ticket:230 Ticket]]
~-[[http://wush.net/trac/wikka/changeset/129 Changelog]]
~-##[[http://wush.net/trac/wikka/browser/trunk/css/wikka.css?rev=129&format=raw css/wikka.css]]##
~-##[[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=129&format=raw formatters/wakka.php]]##
Revision [14616]
Edited on 2006-06-16 07:03:23 by DarTar [patch committed to SVN repository - thanks!]Additions:
>>==See also==
==SVN==
''2006-06-16''
This patch has been committed to the SVN repository and will be included in ##1.1.6.3##:
~-[[Ticket:230 Ticket]]
~-[[http://wush.net/trac/wikka/changeset/129 Changelog]]
Patched files:
~-##[[http://wush.net/trac/wikka/browser/trunk/css/wikka.css?rev=129&format=raw css/wikka.css]]##
~-##[[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=129&format=raw formatters/wakka.php]]##
==SVN==
''2006-06-16''
This patch has been committed to the SVN repository and will be included in ##1.1.6.3##:
~-[[Ticket:230 Ticket]]
~-[[http://wush.net/trac/wikka/changeset/129 Changelog]]
Patched files:
~-##[[http://wush.net/trac/wikka/browser/trunk/css/wikka.css?rev=129&format=raw css/wikka.css]]##
~-##[[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=129&format=raw formatters/wakka.php]]##
Deletions:
Revision [14611]
Edited on 2006-06-15 13:45:20 by TormodHaugen [patch committed to SVN repository - thanks!]No Differences
Revision [14607]
Edited on 2006-06-15 09:33:19 by TormodHaugen [Added links to patches and link to testground.]Additions:
==Test at==
~- [[http://wiki.tormodh.net/SandBox my testwiki]] running 1.1.6.2 beta install with all SimpleTables features.
::c::
::c::
::c::
==Patches for download==
It seems as if there might be some trouble with ''grab''bing and patching the code; these files are tested against the 1.1.6.2 download and should work:
~- [[http://temp.tormodh.net/simpletables.patch simpletables.patch]]
~- [[http://temp.tormodh.net/simpletables_css.patch simpletables_css.patch]]
::c::
~- [[http://wiki.tormodh.net/SandBox my testwiki]] running 1.1.6.2 beta install with all SimpleTables features.
::c::
::c::
::c::
==Patches for download==
It seems as if there might be some trouble with ''grab''bing and patching the code; these files are tested against the 1.1.6.2 download and should work:
~- [[http://temp.tormodh.net/simpletables.patch simpletables.patch]]
~- [[http://temp.tormodh.net/simpletables_css.patch simpletables_css.patch]]
::c::
Revision [14602]
Edited on 2006-06-14 15:21:02 by TormodHaugen [updated functionality. now for 1.1.6.2!]Additions:
I've hacked together a simple table markup for WikkaWiki; it is working it's way from a "layout" table markup to a data table markup.
Currently it supports table header elements (<th>) and table data elements (<td>), cells spanning several columns and/or rows, table summary and caption.
====Basic Usage====
Example (''is not in use, cannot be demonstrated here''):
""||Row 1 Column 1||Row 1 Column 2||Row 1 Column 3||""
""||Row 2 Column 1||Row 2 Column 2||Row 2 Column 3||""
**The delimiter is two pipes (''""||""'').**
~- Use the delimiter to start a new table, row and/or cell.
~- The current row is ended with a delimiter at the end of a line.
~- The table is ended by starting the next line with anything else than a new delimiter after ending a row.
===="Advanced" Usage====
Example (''is not in use, cannot be demonstrated here''):
""|?This is a token summary, must be first line in table markup. PS is between single pipes!|""
""|!|The Caption||""
""|=|First Column|=|Second Column||""
""||First datacell||Second Datacell||""
""|2|A datacell spanning two columns||""
""|,2|A datacell spanning two rows||A cell on the right||""
""||Another cell on the right (due to previous rowspan'd cell)||""
**Enhanced features are enabled by putting modifiers between the pipes.**
~- A caption for the table can be put behind a exclamation mark'ed delimiter (''""|!|""'') and a normal delimiter. ''Needs to be alone on the line!''
~- A summary (for accessability) can be given ''//in//'' a delimiter started by a question mark (''""|?Summary|""''). ''Needs to be alone on the line, and //first// in the markup!''
~- Each row must (still) be ended by a basic (or any, actually) delimiter.
====Wanted====
''I want input on bugs/issues - and on wanted functionality / suggestion on the markup.''
~- better delimiters? Please advice.
~- ++header cells++ Done.
~- ++col/rowspan++ Done.
~- ++caption++ Done.
~- ++summary++ Done.
Patches are for ''Wikka Wakka Wiki 1.1.6.2''. Should be easy to implement manually (or fuzzy) for other versions.
**Save as ''simpletables.patch'' in ''./formatters/'' and apply from there (or do it manually).**
--- wakka.php.orig 2006-06-14 18:42:49.000000000 +0200
+++ wakka.php 2006-06-14 18:42:55.000000000 +0200
@@ -26,6 +26,7 @@
static $indentClosers = array();
static $newIndentSpace= array();
static $br = 1;
static $trigger_bold = 0;
static $trigger_italic = 0;
static $trigger_underline = 0;
@@ -48,6 +49,9 @@
@@ -59,11 +63,68 @@
+ $trigger_bold = $trigger_center = $trigger_floatl = $trigger_inserted = $trigger_deleted = $trigger_italic = $trigger_keys = $trigger_table = 0;
+ if ( preg_match("/^\|(\?)(.*?)?\|(\n)?$/", $thing, $matches) ) {
+ if ( $trigger_table == 0 ) {
+ //TODO escape text for safety
+ return '<table class="wikka" summary="'.$matches[2].'">'."\n";
+ else if ( preg_match("/^\|(=|!)?(\d*)?(?:,)?(\d*)?\|(\n)?$/", $thing, $matches) ) {
+ //First catch is header|caption|summary, second is colspan, third is rowspan, fourth is linebreak.
+ if ( $trigger_table == 0 )
+ $rs = "<table class=\"wikka\">\n";
+ if ($matches[1] == "!") {
+ $trigger_table = 4;
+ return $rs."<caption>";
+ } else {
+ $rs .= "<tr>";
+ }
+ else if ( $trigger_table == 1 ) {
+ if ($matches[1] == "!") {
+ $trigger_table = 4;
+ return "<caption>";
+ } else {
+ $rs = "<tr>";
+ }
+ else if ( $trigger_table == 4 ) {
+ return "</caption>\n";
@@ -414,6 +475,7 @@
"\*\*|\'\'|\#\#|\#\%|@@|::c::|\>\>|\<\<|££|¥¥|\+\+|__|<|>|\/\/|". # Wiki markup
**Save as ''simpletables_css.patch'' in ''./css/'' and apply from there (or do it manually).**
--- wikka.css.orig 2006-06-14 18:48:36.000000000 +0200
+++ wikka.css 2006-06-14 18:54:27.000000000 +0200
@@ -446,6 +446,11 @@
border-spacing: 0;
+ border: 1px solid #CCC;
table.wikka td {
border: 1px solid #CCC;
padding: .1em .25em;
@@ -600,4 +605,4 @@
.toolbar .btn-active,
.toolbar .btn-pressed { border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; }
.toolbar .btn-pressed { background: ButtonHighlight; }
-.editornamecss { background-color:#CCCCFF; font-size: 18px; padding: 0 10px; }
+.editornamecss { background-color:#CCCCFF; font-size: 18px; padding: 0 10px; }
Currently it supports table header elements (<th>) and table data elements (<td>), cells spanning several columns and/or rows, table summary and caption.
====Basic Usage====
Example (''is not in use, cannot be demonstrated here''):
""||Row 1 Column 1||Row 1 Column 2||Row 1 Column 3||""
""||Row 2 Column 1||Row 2 Column 2||Row 2 Column 3||""
**The delimiter is two pipes (''""||""'').**
~- Use the delimiter to start a new table, row and/or cell.
~- The current row is ended with a delimiter at the end of a line.
~- The table is ended by starting the next line with anything else than a new delimiter after ending a row.
===="Advanced" Usage====
Example (''is not in use, cannot be demonstrated here''):
""|?This is a token summary, must be first line in table markup. PS is between single pipes!|""
""|!|The Caption||""
""|=|First Column|=|Second Column||""
""||First datacell||Second Datacell||""
""|2|A datacell spanning two columns||""
""|,2|A datacell spanning two rows||A cell on the right||""
""||Another cell on the right (due to previous rowspan'd cell)||""
**Enhanced features are enabled by putting modifiers between the pipes.**
~- A caption for the table can be put behind a exclamation mark'ed delimiter (''""|!|""'') and a normal delimiter. ''Needs to be alone on the line!''
~- A summary (for accessability) can be given ''//in//'' a delimiter started by a question mark (''""|?Summary|""''). ''Needs to be alone on the line, and //first// in the markup!''
~- Each row must (still) be ended by a basic (or any, actually) delimiter.
====Wanted====
''I want input on bugs/issues - and on wanted functionality / suggestion on the markup.''
~- better delimiters? Please advice.
~- ++header cells++ Done.
~- ++col/rowspan++ Done.
~- ++caption++ Done.
~- ++summary++ Done.
Patches are for ''Wikka Wakka Wiki 1.1.6.2''. Should be easy to implement manually (or fuzzy) for other versions.
**Save as ''simpletables.patch'' in ''./formatters/'' and apply from there (or do it manually).**
--- wakka.php.orig 2006-06-14 18:42:49.000000000 +0200
+++ wakka.php 2006-06-14 18:42:55.000000000 +0200
@@ -26,6 +26,7 @@
static $indentClosers = array();
static $newIndentSpace= array();
static $br = 1;
static $trigger_bold = 0;
static $trigger_italic = 0;
static $trigger_underline = 0;
@@ -48,6 +49,9 @@
@@ -59,11 +63,68 @@
+ $trigger_bold = $trigger_center = $trigger_floatl = $trigger_inserted = $trigger_deleted = $trigger_italic = $trigger_keys = $trigger_table = 0;
+ if ( preg_match("/^\|(\?)(.*?)?\|(\n)?$/", $thing, $matches) ) {
+ if ( $trigger_table == 0 ) {
+ //TODO escape text for safety
+ return '<table class="wikka" summary="'.$matches[2].'">'."\n";
+ else if ( preg_match("/^\|(=|!)?(\d*)?(?:,)?(\d*)?\|(\n)?$/", $thing, $matches) ) {
+ //First catch is header|caption|summary, second is colspan, third is rowspan, fourth is linebreak.
+ if ( $trigger_table == 0 )
+ $rs = "<table class=\"wikka\">\n";
+ if ($matches[1] == "!") {
+ $trigger_table = 4;
+ return $rs."<caption>";
+ } else {
+ $rs .= "<tr>";
+ }
+ else if ( $trigger_table == 1 ) {
+ if ($matches[1] == "!") {
+ $trigger_table = 4;
+ return "<caption>";
+ } else {
+ $rs = "<tr>";
+ }
+ else if ( $trigger_table == 4 ) {
+ return "</caption>\n";
@@ -414,6 +475,7 @@
"\*\*|\'\'|\#\#|\#\%|@@|::c::|\>\>|\<\<|££|¥¥|\+\+|__|<|>|\/\/|". # Wiki markup
**Save as ''simpletables_css.patch'' in ''./css/'' and apply from there (or do it manually).**
--- wikka.css.orig 2006-06-14 18:48:36.000000000 +0200
+++ wikka.css 2006-06-14 18:54:27.000000000 +0200
@@ -446,6 +446,11 @@
border-spacing: 0;
+ border: 1px solid #CCC;
table.wikka td {
border: 1px solid #CCC;
padding: .1em .25em;
@@ -600,4 +605,4 @@
.toolbar .btn-active,
.toolbar .btn-pressed { border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; }
.toolbar .btn-pressed { background: ButtonHighlight; }
-.editornamecss { background-color:#CCCCFF; font-size: 18px; padding: 0 10px; }
+.editornamecss { background-color:#CCCCFF; font-size: 18px; padding: 0 10px; }
Deletions:
~- http://temp.tormodh.net/simpletables_beta.patch
~- http://temp.tormodh.net/simpletables_css_beta.patch
I've hacked together a simple table markup for WikkaWiki; it is working it's way from a "layout" table markup to a **data** table markup.
Currently it supports table header elements (<th>) and table data elements (<td>), and also cells spaning several columns and/or rows.
====Usage====
Basic delimiter is two pipes (''""||""''). This will start a normal datacell.
Enhanced features are enabled by putting modifiers between the pipes:
Each row must be ended by a basic (or any, actually) delimiter.
A table is ended when no cell is open and there is any data except a delimiter at the start of the line - or at the end of the page's data.
~- better delimiters? please advice.
~- caption (currently planned: ++''""|c|""'' **or maybe**++ ''""|!|""'') - ''in testing''
~- ++summary (currently planned: ''""|s|""'' **or maybe** ''""|?|""'')++ ''summary isn't an element until XHTML 2.0 :/''
~- close row at end of line (if people does not want to be able to spread a cell over multiple lines).
~- fix known issue (different behavior if previous ''todo'' is implemented or not).
Patches are for ''Wikka Wakka Wiki 1.1.6.1''
First comes ''new and improved'' patch for wakka.php and wikka.css - then comes old patches for the same. Revert the latter pair, install the former pair. :)
**Below is the new patch containing headers and col/rowspan. Remember to remove the old patch (it is at the bottom of the page):**
--- wakka.php.orig 2006-05-18 12:56:27.000000000 +0200
+++ wakka.php 2006-06-04 23:20:56.000000000 +0200
@@ -28,12 +28,16 @@
static $trigger_strike = 0;
static $trigger_inserted = 0;
static $trigger_center = 0;
static $trigger_l = array(-1, 0, 0, 0, 0, 0);
global $wakka;
@@ -45,11 +49,41 @@
+ $trigger_bold = $trigger_center = $trigger_table = $trigger_floatl = $trigger_inserted = $trigger_deleted = $trigger_italic = $trigger_keys = 0;
+ if ( preg_match("/^\|(=)?(\d*)?(?:,)?(\d*)?\|(\n)?$/", $thing, $matches) ) {
+ //First catch is header, second is colspan, third is rowspan, fourth is linebreak.
+ if ( $trigger_table == 0 ) $rs = "<table class=\"wikka\">\n<tr>";
+ else if ( $trigger_table == 1 ) $rs = "<tr>";
@@ -371,6 +405,7 @@
"\n". # new line
@@ -382,4 +417,4 @@
echo ($text);
wakka2callback('closetags');
-?>
+?>
**Patch for ''./css/wikka.css'' is here, work it as above (put the file in the ''css'' directory).**
--- wikka.css.orig 2006-05-18 13:05:30.000000000 +0200
+++ wikka.css 2006-06-04 23:58:44.000000000 +0200
@@ -412,3 +412,18 @@
color: #993333;
text-decoration: none;
+/* SimpleTable style */
+table.wikka {
+ border: 2px solid #ccc;
+ border-collapse: collapse;
+ border-spacing: 0;
+table.wikka td {
+ border: 1px solid #ccc;
+ border: 1px solid #ccc;
**''OLD'' patch for ''./formatters/wakka.php'' is here, this is the one to ''revert'':**
--- wakka.php.orig 2006-05-18 12:56:27.000000000 +0200
+++ wakka.php 2006-05-15 21:29:54.000000000 +0200
@@ -28,12 +28,15 @@
static $trigger_strike = 0;
static $trigger_inserted = 0;
static $trigger_center = 0;
static $trigger_l = array(-1, 0, 0, 0, 0, 0);
global $wakka;
+ if (1 < $trigger_table) echo ('</td></tr>');
@@ -45,11 +48,41 @@
+ $trigger_bold = $trigger_center = $trigger_table = $trigger_floatl = $trigger_inserted = $trigger_deleted = $trigger_italic = $trigger_keys = 0;
+ if ($trigger_table == 0)
+ {
+ //We're not in a table, check to see if we want to create one
+ if (preg_match("/\n\|\|/s", $thing, $matches)) {
+ return "<br />\n<table class=\"wikka\">\n<tr><td>";
+ else if ($trigger_table == 1)
+ {
+ //We're in a table, but not in a cell. Create new row+cell? or end table?
+ if (preg_match("/\|\|/s", $thing, $matches))
+ return "<tr><td>";
+ else if ($thing != "")
+ $trigger_table = 0;
+ return "</table>\n".wakka2callback($things);
+ else if ($trigger_table == 2)
+ {
+ //We're in a cell, check for newline if we need a new row + last ended.
+ if (preg_match("/\n\|\|/s", $thing, $matches))
+ return "</td></tr>\n<tr><td>";
@@ -70,6 +103,17 @@
return ("<div class=\"clear\"> </div>\n");
+ // end cell + row.
+ else if (preg_match("/\|\|\n/s", $thing, $matches))
+ {
+ $trigger_table = 1;
+ return "</td></tr>\n";
+ // end cell + start cell. all other stuff handeled before.
+ else if ($thing == "||")
+ {
+ return "</td><td>";
// keyboard
else if ($thing == "#%")
@@ -371,6 +415,7 @@
+ "\n\|\||\|\|\n|\|\||". # Simple Tables
"\n". # new line
@@ -382,4 +427,4 @@
echo ($text);
wakka2callback('closetags');
-?>
+?>
**''Old'' patch for ''./css/wikka.css'' is here, remove this one if you didn't make the css yourself.**
--- wikka.css.orig 2006-05-18 13:05:30.000000000 +0200
+++ wikka.css 2006-05-05 00:18:36.000000000 +0200
@@ -412,3 +412,14 @@
color: #993333;
text-decoration: none;
+/* SimpleTable style */
+table.wikka {
+ border: 2px solid #ccc;
+ border-collapse: collapse;
+ border-spacing: 0;
+table.wikka td {
+ border: 1px solid #ccc;
Additions:
~- caption (currently planned: ++''""|c|""'' **or maybe**++ ''""|!|""'') - ''in testing''
~- ++summary (currently planned: ''""|s|""'' **or maybe** ''""|?|""'')++ ''summary isn't an element until XHTML 2.0 :/''
~- ++summary (currently planned: ''""|s|""'' **or maybe** ''""|?|""'')++ ''summary isn't an element until XHTML 2.0 :/''
Deletions:
~- summary (currently planned: ''""|s|""'' **or maybe** ''""|?|""'')
Additions:
==See also==
~- WikkaTables
~- TableAction
==Patches for 1.1.6.2 (''beta''):==
~- http://temp.tormodh.net/simpletables_beta.patch
~- http://temp.tormodh.net/simpletables_css_beta.patch
A table is ended when no cell is open and there is any data except a delimiter at the start of the line - or at the end of the page's data.
~- better delimiters? please advice.
~- caption (currently planned: ''""|c|""'' **or maybe** ''""|!|""'')
~- summary (currently planned: ''""|s|""'' **or maybe** ''""|?|""'')
Patches are for ''Wikka Wakka Wiki 1.1.6.1''
~- WikkaTables
~- TableAction
==Patches for 1.1.6.2 (''beta''):==
~- http://temp.tormodh.net/simpletables_beta.patch
~- http://temp.tormodh.net/simpletables_css_beta.patch
A table is ended when no cell is open and there is any data except a delimiter at the start of the line - or at the end of the page's data.
~- better delimiters? please advice.
~- caption (currently planned: ''""|c|""'' **or maybe** ''""|!|""'')
~- summary (currently planned: ''""|s|""'' **or maybe** ''""|?|""'')
Patches are for ''Wikka Wakka Wiki 1.1.6.1''
Deletions:
WikkaTables
TableAction
**Test at**
[[http://wiki.tormodh.net/SandBox my test wiki:SandBox]]
**Patches for 1.1.6.2 (''beta''):**
http://temp.tormodh.net/simpletables_beta.patch
http://temp.tormodh.net/simpletables_css_beta.patch
A table is ended when no cell is open and there is any data except a delimiter at the start of the line, or at the end of the page's data.
~- better delimiters. please advice.
~- caption (currently planned: ''""|c|""'')
~- summary (currently planned: ''""|s|""'')
Patches is for ''Wikka Wakka Wiki 1.1.6.1''
Additions:
**Patches for 1.1.6.2 (''beta''):**
http://temp.tormodh.net/simpletables_beta.patch
http://temp.tormodh.net/simpletables_css_beta.patch
http://temp.tormodh.net/simpletables_beta.patch
http://temp.tormodh.net/simpletables_css_beta.patch
Revision [14463]
Edited on 2006-06-04 18:14:34 by TormodHaugen [added new functionality, and more todos]Additions:
**Test at**
[[http://wiki.tormodh.net/SandBox my test wiki:SandBox]]
I've hacked together a simple table markup for WikkaWiki; it is working it's way from a "layout" table markup to a **data** table markup.
Currently it supports table header elements (<th>) and table data elements (<td>), and also cells spaning several columns and/or rows.
Basic delimiter is two pipes (''""||""''). This will start a normal datacell.
Enhanced features are enabled by putting modifiers between the pipes:
~- A header cell is started with a equals sign (''""|=|""'').
~- A cell span is started with numbers seperated by a comma. (''""|2|""'' = colspan="2", ''""|2,2|""'' = col+rowspan ="2" each, ''""|,2|""'' = rowspan="2" only).
Each row must be ended by a basic (or any, actually) delimiter.
A table is ended when no cell is open and there is any data except a delimiter at the start of the line, or at the end of the page's data.
~- better delimiters. please advice.
~- caption (currently planned: ''""|c|""'')
~- summary (currently planned: ''""|s|""'')
~- close row at end of line (if people does not want to be able to spread a cell over multiple lines).
~- fix known issue (different behavior if previous ''todo'' is implemented or not).
First comes ''new and improved'' patch for wakka.php and wikka.css - then comes old patches for the same. Revert the latter pair, install the former pair. :)
**Below is the new patch containing headers and col/rowspan. Remember to remove the old patch (it is at the bottom of the page):**
+++ wakka.php 2006-06-04 23:20:56.000000000 +0200
@@ -28,12 +28,16 @@
+ if (2 < $trigger_table) echo ('</th></tr>');
+ else if (1 < $trigger_table) echo ('</td></tr>');
@@ -45,11 +49,41 @@
+ // table. trigger means: 0==no table, 1==in table no cell, 2==in table data cell, 3==in table header cell
+ if ( preg_match("/^\|(=)?(\d*)?(?:,)?(\d*)?\|(\n)?$/", $thing, $matches) ) {
+ //First catch is header, second is colspan, third is rowspan, fourth is linebreak.
+ if ( $trigger_table == 0 ) $rs = "<table class=\"wikka\">\n<tr>";
+ else if ( $trigger_table == 1 ) $rs = "<tr>";
+ else if ( $trigger_table == 2 ) $rs = "</td>";
+ else if ( $trigger_table == 3 ) $rs = "</th>";
+
+ if ( $trigger_table > 1 && $matches[4] == "\n") {
+ $trigger_table = 1;
+ return $rs."</tr>\n";
+
+ if ( $matches[1] == "=" ) {
+ $trigger_table = 3;
+ $rs .= "<th";
+ } else if ( $matches[1] == "" ) {
+ $rs .= "<td";
+ if ( $matches[2] && $matches[2] > 1 ) $rs .= " colspan=\"$matches[2]\"";
+ if ( $matches[3] && $matches[3] > 1 ) $rs .= " rowspan=\"$matches[3]\"";
+
+ return $rs.">";
+ } else if ( $trigger_table == 1 ) {
+ //Are in table, no cell - but not asked to open new: please close and parse again. ;)
+ $trigger_table = 0;
+ return "</table>\n".wakka2callback($things);
@@ -371,6 +405,7 @@
+ "\|[^\|]*?\|(?:\n)?|". # Simple Tables
@@ -382,4 +417,4 @@
%%(css)
+++ wikka.css 2006-06-04 23:58:44.000000000 +0200
@@ -412,3 +412,18 @@
+table.wikka th {
**''OLD'' patch for ''./formatters/wakka.php'' is here, this is the one to ''revert'':**
**''Old'' patch for ''./css/wikka.css'' is here, remove this one if you didn't make the css yourself.**
%%(css)
Please comment / tell me of any suggestions. --TormodHaugen
[[http://wiki.tormodh.net/SandBox my test wiki:SandBox]]
I've hacked together a simple table markup for WikkaWiki; it is working it's way from a "layout" table markup to a **data** table markup.
Currently it supports table header elements (<th>) and table data elements (<td>), and also cells spaning several columns and/or rows.
Basic delimiter is two pipes (''""||""''). This will start a normal datacell.
Enhanced features are enabled by putting modifiers between the pipes:
~- A header cell is started with a equals sign (''""|=|""'').
~- A cell span is started with numbers seperated by a comma. (''""|2|""'' = colspan="2", ''""|2,2|""'' = col+rowspan ="2" each, ''""|,2|""'' = rowspan="2" only).
Each row must be ended by a basic (or any, actually) delimiter.
A table is ended when no cell is open and there is any data except a delimiter at the start of the line, or at the end of the page's data.
~- better delimiters. please advice.
~- caption (currently planned: ''""|c|""'')
~- summary (currently planned: ''""|s|""'')
~- close row at end of line (if people does not want to be able to spread a cell over multiple lines).
~- fix known issue (different behavior if previous ''todo'' is implemented or not).
First comes ''new and improved'' patch for wakka.php and wikka.css - then comes old patches for the same. Revert the latter pair, install the former pair. :)
**Below is the new patch containing headers and col/rowspan. Remember to remove the old patch (it is at the bottom of the page):**
+++ wakka.php 2006-06-04 23:20:56.000000000 +0200
@@ -28,12 +28,16 @@
+ if (2 < $trigger_table) echo ('</th></tr>');
+ else if (1 < $trigger_table) echo ('</td></tr>');
@@ -45,11 +49,41 @@
+ // table. trigger means: 0==no table, 1==in table no cell, 2==in table data cell, 3==in table header cell
+ if ( preg_match("/^\|(=)?(\d*)?(?:,)?(\d*)?\|(\n)?$/", $thing, $matches) ) {
+ //First catch is header, second is colspan, third is rowspan, fourth is linebreak.
+ if ( $trigger_table == 0 ) $rs = "<table class=\"wikka\">\n<tr>";
+ else if ( $trigger_table == 1 ) $rs = "<tr>";
+ else if ( $trigger_table == 2 ) $rs = "</td>";
+ else if ( $trigger_table == 3 ) $rs = "</th>";
+
+ if ( $trigger_table > 1 && $matches[4] == "\n") {
+ $trigger_table = 1;
+ return $rs."</tr>\n";
+
+ if ( $matches[1] == "=" ) {
+ $trigger_table = 3;
+ $rs .= "<th";
+ } else if ( $matches[1] == "" ) {
+ $rs .= "<td";
+ if ( $matches[2] && $matches[2] > 1 ) $rs .= " colspan=\"$matches[2]\"";
+ if ( $matches[3] && $matches[3] > 1 ) $rs .= " rowspan=\"$matches[3]\"";
+
+ return $rs.">";
+ } else if ( $trigger_table == 1 ) {
+ //Are in table, no cell - but not asked to open new: please close and parse again. ;)
+ $trigger_table = 0;
+ return "</table>\n".wakka2callback($things);
@@ -371,6 +405,7 @@
+ "\|[^\|]*?\|(?:\n)?|". # Simple Tables
@@ -382,4 +417,4 @@
%%(css)
+++ wikka.css 2006-06-04 23:58:44.000000000 +0200
@@ -412,3 +412,18 @@
+table.wikka th {
**''OLD'' patch for ''./formatters/wakka.php'' is here, this is the one to ''revert'':**
**''Old'' patch for ''./css/wikka.css'' is here, remove this one if you didn't make the css yourself.**
%%(css)
Please comment / tell me of any suggestions. --TormodHaugen
Deletions:
You can use other WikkaMarkup inside the table, and if you forget to close the table, it will close by itself before the ''footer''.
See it in use here: [[http://wiki.tormodh.net/SimpleTable]]
A new row is created by starting a line with ''""||""''. Each new cell is started by another ''""||""''. A row is ended by 1) Either ending a line with ''""||""'' and a newline. 2) Starting a new line with ''""||""''. The table is ended by having ''""||""'' on the end of one line, and not opening another row at the next (active) line. **One empty line does not end the table**.
~- Table headers (markup ''"|=|"'')
~- Col-/Rowspan (markup ''"|x,y|"'') //not sure if it is good to have too much features in a simple table markup//
please comment.
headers + col/rowspan are in testing at [[http://wiki.tormodh.net/SandBox]]
**Patch for ''./formatters/wakka.php'' is here, work it by putting it in the ''formatters'' directory:**
Please comment / edit this code / tell me if it isn't good enough. --TormodHaugen
Revision [14445]
Edited on 2006-06-02 19:55:55 by TormodHaugen [added new functionality, and more todos]Additions:
~- Col-/Rowspan (markup ''"|x,y|"'') //not sure if it is good to have too much features in a simple table markup//
headers + col/rowspan are in testing at [[http://wiki.tormodh.net/SandBox]]
headers + col/rowspan are in testing at [[http://wiki.tormodh.net/SandBox]]
Deletions:
headers are in testing at [[http://wiki.tormodh.net/SandBox]]
Additions:
====TODO====
~- Table headers (markup ''"|=|"'')
~- Col-/Rowspan (markup ''"|x,y|"'')
please comment.
headers are in testing at [[http://wiki.tormodh.net/SandBox]]
~- Table headers (markup ''"|=|"'')
~- Col-/Rowspan (markup ''"|x,y|"'')
please comment.
headers are in testing at [[http://wiki.tormodh.net/SandBox]]
Additions:
====Known Issues====
Ending the table with a ''""||""'' delimiter without a newline adds another cell/column. (''//**ie:** if there is no more content after the table, or if there is a space after the delimiter//'').
Ending the table with a ''""||""'' delimiter without a newline adds another cell/column. (''//**ie:** if there is no more content after the table, or if there is a space after the delimiter//'').