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)

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

PWiki/WEB-INF/lib/jspwiki-main-2.11.0.M7-SNAPSHOT.jar: ../jspwiki/jspwiki-war/target/JSPWiki/WEB-INF/lib/log4j-1.2.17.jar: -target 1.8  src/main/java/brushed/jspwiki/tableplugin/*.java }}}

Then build the jar. The path should be related to src/

jar cvf Table.jar 
  -C src/main/java src/main/java/brushed/jspwiki/tableplugin/*.class 
  -C src/main/resources ini

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