Table plugin#

The TablePlugin extends JSPWiki's table markup.
It allows to:
  • merge cells horizontally and/or vertically (aka colspan and rowspan).
  • nest tables inside other tables inside other tables...
  • add styles to table rows and table cells
  • auto-number the rows
  • use multi-line table rows and cells to support large or complex table cells.

Standard JSPWiki table markup #

See also TextFormattingRules :

  • a new line of text starting with a pipe character | indicates the start of a new table row.
  • each line corresponds with a table row, containing one or more table cells.
    • a single pipe | starts a new data cell.
    • a double pipe || starts a header cell with different formatting.
  • end the table with a line which does not start with a pipe character.

New extra table markup provided by the TablePlugin#

  • span multiple columns with |< or ||< to collapse this cell with the previous cell
  • span multiple rows with |^ or ||^ to collapse this cell with the cell above
  • add css styles to cells with |(<css-style>) or ||(<css-style>)
  • add row numbers to a cell with |# or ||#

Example:#

[{Table

||Nr ||A ||< ||C ||<
|#   |a  |b  |c  |(background: peachpuff;)d
|#   |^  |b  |^  |(background: peachpuff;)d
}]

becomes (simulated)

@import url(https://fonts.googleapis.com/css?family=Source+Code+Pro); .mono { font-family: "Source Code Pro",monospace; line-height:1;}
+----+-------+-------+
| Nr | A     | C     |
+----+---+---+---+---+
| 1  | a | b | c | d |
+----+   +---+   +---+
| 2  |   | b |   | d |
+----+---+---+---+---+

Multi-line table editing#

The standard table markup of JSPWiki requires you to put all data related to a row on a single line of text. (without carriage returns) With the Table plugin, a single row or cell can be entered on multiple lines. You can compare a multi-line table row to a bulleted list, whereby you replace the bullets ('*') with pipes ('|' or '||'). A blank line is used a separator between multi-line rows.

| These cells
| will all appear
| as a single table row

| This is | a second | row

It is also possible to put the contents of a single cell across multiple lines. So it becomes easy to put lots of text and markup inside a single table cell and still keep your markup readable.

| This cell
  is put over 2 lines
| The 2nd cell comes here
  all on the same row!

You can combine mutiline rows with standard wiki table syntax too. As long as a single line contains only one table cell, it is assumed to continue on the next line. Multi-line rows always need to be terminated with a blank lines. Standard wiki table rows may omit the blank separator lines.

| This row has 
| Two cells

| You can also    | use standard wiki markup.
| Here is another | table row

You can also combine the multi line syntax with the |<, |^, |(<css-style>) and |#.

Example:#

[{Table style='border:2px solid tomato; width:50vw;'

|| Heading 1 
|| Heading 2

| This is a magic multi-line cell ...
* with one or ...
* two list bullets
|(background:peachpuff;) And a  peachpuff submarine

|(padding:0;) [{Image src='https://source.unsplash.com/-g4dgdOExsw/' width='100%' height='100px }]  
|<

JSPWiki : TablePlugin - Plugin insertion failed: Could not find plugin TableJSPWiki : TablePlugin - Plugin insertion failed: Could not find plugin Table

Usage#

[{Table <table-parameters>

|| Table Header Example || More... 
|  Table Data Example   |  More...
}]

Parameters:#

  • rowNumber : <integer> , row number starts counting at this value, default = 0 (used in conjunction with '#' syntax)
  • style : <css-style> , add formatting to the table e.g. style:'border=2px solid black;'
  • dataStyle : <css-style> , format all data cells (prefixed by a single pipe | )
  • headerStyle : <css-style> , format all header cells (prefixed by a double pipe ||)
  • evenRowStyle : <css-style> , format the even rows, e.g. evenRowStyle='background: #ffff00;'
  • oddRowStyle : <css-style> . format the odd rows, e.g. oddRowStyle='color: red;'

Change History#

  • v0.1 : first version
  • v0.2 : client-side sorting of tables : now handled by SortableTables / 24 oct 05
  • v0.3 : removed escape parameter: JSPWiki (v2.4.x) now supports nested plugin calls / jun 06

Installation Instructions#

See Installing Plugins

  • Copy Table.jar to the folder $WIKI_HOME/WEB-INF/lib/ (or server classpath)
  • Modify the plugin search path in your jspwiki-custom.properties file and make sure there are no spaces between the different entries.
jspwiki.plugin.searchPath = brushed.jspwiki.tableplugin
  • Restart JSPWiki

Real Life Examples#

Example 1 : table with row and column spans#

[{Table

|Nr |A |< |C |<
|#  |a |b |c |(background: peachpuff;)d
|#  |^ |b |^ |(background: peachpuff;)d
}]

JSPWiki : TablePlugin - Plugin insertion failed: Could not find plugin brushed.jspwiki.tableplugin.TableJSPWiki : TablePlugin - Plugin insertion failed: Could not find plugin brushed.jspwiki.tableplugin.Table

Example 2: table with extra styles#

[{Table style='width:auto' oddRowStyle='background:#f0f0f0;' evenRowStyle='background:#ff9;' rowNumber='-1'

|| [THE 15 MOST POPULAR ICE CREAM FLAVORS|http://www.sendicecream.com/15mospopicec.html] 
||< 
||< 

||  ||Flavor              || percent preferring
|#. |Vanilla              | 29%
|#. |Chocolate            | 8.9%
|#. |Butter pecan         | 5.3%
|#. |Strawberry           | 5.3%
|#. |Neapolitan           | 4.2%
|#. |Chocolate chip       | 3.9%
|#. |French vanilla       | 3.8%
|#. |Cookies and cream    | 3.6%
|#. |Vanilla fudge ripple | 2.6%
|#. |Praline pecan        | 1.7%
|#. |Cherry               | 1.6%
|#. |Chocolate almond     | 1.6%
|#. |Coffee               | 1.6%
|#. |Rocky road           | 1.5%
|#. |Chocolate marshmallow| 1.3%
|All others|<             | 23.7%  
|%%small.align-right ''Source: International Ice Cream Association, 888 16th St. Washington, D.C., 20006'' /%  |< |<
}]

JSPWiki : TablePlugin - Plugin insertion failed: Could not find plugin TableJSPWiki : TablePlugin - Plugin insertion failed: Could not find plugin Table

Example 3: table with multi-line editing#

[{Table style='border:3px solid #cccccc;'

|(text-align:center;font-weight:bold; background:#cccccc;) Hi dear Wiki. 
|<
|<

| Date: [{CurrentTimePlugin format='dd:MMM:yyyy'}] 
| Time: [{CurrentTimePlugin format='hh:mm:ss'}]
| This page: [{$pagename}] 

| [{Table 

| Nested table | Nested table
| Nested table | Nested table
}]
|<
|<

| [JSPWikiStyles/poppy.jpg] |< |<
}]

JSPWiki : TablePlugin - Plugin insertion failed: Could not find plugin TableJSPWiki : TablePlugin - Plugin insertion failed: Could not find plugin Table