Table plugin#

Introduction#

The TablePlugin extends JSPWiki's table markup. It allows to merge cells horizontally and/or vertically (aka colspan and rowspan); it has support for auto-numbering of rows, it allows table rows and cells to be entered on multiple lines for easy entry of large or complex table cells, it allows nesting of tables and it has advanced support for table styles. --DF

Standard JSPWiki table markup#

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

Extended TablePlugin markup#

  • use |< or ||< to span multiple columns
  • use |^ or ||^ to spans multiple rows
  • use |( <css-style> ) to add css styles to a cell
  • use |# to display the row number. (auto row numbering)

Example:

   |Nr |A |< |C |<
   |#  |a |b |c |(background:yellow;)d
   |#  |^ |b |^ |(background:yellow;)d
becomes (simulated)

  +----+-------+-------+
  | 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 every row on a single line 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 to mark the end of a table row.

| 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 is 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

You can combine muti-line 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 blank lines; for standard wiki table rows you may omit the blank 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 |<, |^, | and |#.

Example:

   || Heading 1 
   || Heading 2

   | This is a magic multi-line cell ...
   * with a bulletrf list
   |(background:yellow;) The yellow submarine

   | [{Image src='nice-picture'}]  
   |<

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 single pipe signs '|')
  • headerStyle : <css-style> , format all header cells (prefixed by double pipe signs '||')
  • 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#

  • Copy Table.jar to the folder /WEB-INF/lib/
  • Modify the plugin searchPath in your WEB-INF/jspwiki.properties and make sure there are no spaces between the different entries. Example:
       jspwiki.plugin.searchPath = brushed.jspwiki.tableplugin
  • Restart JSPWiki

Examples#

Example 1 : table with row and column spans#

[{Table

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

Example 2: table with extra style#

[{Table 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%  
}]
Source: International Ice Cream Association, 888 16th St. Washington, D.C., 20006

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] |< |<
}]

Category.Plugins