Tags:
css1Add my vote for this tag rendering1Add my vote for this tag tables1Add my vote for this tag create new tag
, view all tags

BoundedTablePlugin

Renders tables from a bounded specification starting with %BOUNDEDTABLE{}% and finishing with %ENDBOUNDEDTABLE%. I got tired of the lack of css support in the table statement and with the inconvenience of having to escape all the lines in a row. BoundedTablePlugin addresses both these issues.

BoundedTablePlugin does all the rendering using styles and uses a non TWiki type syntax for the table. The syntax is based on the syntax proposed in Wikipedia.


Syntax Rules

  • Bounded tables start with a %BOUNDEDTABLE{...}% statement
  • and fninish with a %ENDBOUNDEDTABLE% statement
  • bounded tables can be nested
  • bounded tables use |- (pipe, minus) in column one as the row separator
  • bounded tables identify a cell as bounded by two pipes, Like TWiki tables
    • since rows are separately identified, cells can continue over multiple lines. without special syntax

Table Attributes

Attributes are defined in line before the table using %BOUNDEDTABLE{...}%:

Argument Comment Example
tablewidth The width of the table in px, % or other valid value. tablewidth="auto"
tableclass The class associated with the <TABLE tag. tableclass="boundedtable"
columnwidths The width of each column in px, % or other value value. columnwidths="60%, 30%, 10%"
headerrows The number of rows in the header. headerrows="1"

Examples

Define the following styles:

/* additions to test the BOUNDEDTABLE plugin */
table.boundedtable {border: 5px solid #ff0000;}
table.boundedtable tr th {text-align:center;font-weight: bold; padding: 2px; color: #00ff00; background: #0000ff}
table.boundedtable tr.oddrow {background: #00f000}
table.boundedtable tr.evenrow {background: #0000f0}

table.plainboundedtable {border-collapse:collapse;border: 1px solid #003f9f;border-spacing: 0px}
table.plainboundedtable tr th {text-align:left;font-weight: bold; padding: 2px; color: #c2d4ef; background: #003f9f}
table.plainboundedtable tr {padding: 2px; background: #c2d4ef}

table.twikiboundedtable {border: 1px solid #003f9f;border-spacing: 0px}
table.twikiboundedtable tr th { background: #99CCCC}
table.twikiboundedtable tr.oddrow {background: #FFFFFF}
table.twikiboundedtable tr.evenrow {background: #FFFFCC}

The following code presents the table below.

%BOUNDEDTABLE{tableclass="boundedtable" tablewidth="60%" columnwidths="60%, 30%, 10%" headerrows="1"}%
|cell 1 1| cell 1 2| cell 1 3|
|-
| cell 2 1|cell 2 2| 
%BOUNDEDTABLE{tableclass="boundedtable" columnwidths="80%, 20%"}%
|T1|T2|
|-
||row 2 2|
%ENDBOUNDEDTABLE%
|
|-
| cell 3 1| cell 3 2| cell 3 3|
|-
| cell 4 1| cell 4 2| cell 4 3|
|-
|
%BOUNDEDTABLE{tableclass="boundedtable" tablewidth="100%" columnwidths="40%, 60%"}%
|T1|T2|
|-
||row 2 2|
%ENDBOUNDEDTABLE% 
|| cell 5 3|
|-
| cell 6 1| cell 6 2| cell 6 3|
%ENDBOUNDEDTABLE%

Table 1

%BOUNDEDTABLE{tableclass="boundedtable" tablewidth="60%" columnwidths="60%, 30%, 10%" headerrows="1"}%

cell 1 1 cell 1 2 cell 1 3
|-
cell 2 1 cell 2 2
%BOUNDEDTABLE{tableclass="boundedtable" columnwidths="80%, 20%"}%
T1 T2
|-
row 2 2
%ENDBOUNDEDTABLE% | |-
cell 3 1 cell 3 2 cell 3 3
|-
cell 4 1 cell 4 2 cell 4 3
|- | %BOUNDEDTABLE{tableclass="boundedtable" tablewidth="100%" columnwidths="40%, 60%"}%
T1 T2
|-
row 2 2
%ENDBOUNDEDTABLE%
cell 5 3
|-
cell 6 1 cell 6 2 cell 6 3
%ENDBOUNDEDTABLE%

When you change the tableclass to plainboundedtable

%BOUNDEDTABLE{tableclass="plainboundedtable" tablewidth="60%" columnwidths="60%, 30%, 10%" headerrows="1"}%
the presentation becomes:

Table 2

%BOUNDEDTABLE{tableclass="plainboundedtable" tablewidth="60%" columnwidths="60%, 30%, 10%" headerrows="1"}%

cell 1 1 cell 1 2 cell 1 3
|-
cell 2 1 cell 2 2
%BOUNDEDTABLE{tableclass="boundedtable" columnwidths="80%, 20%"}%
T1 T2
|-
row 2 2
%ENDBOUNDEDTABLE% | |-
cell 3 1 cell 3 2 cell 3 3
|-
cell 4 1 cell 4 2 cell 4 3
|- | %BOUNDEDTABLE{tableclass="boundedtable" tablewidth="100%" columnwidths="40%, 60%"}%
T1 T2
|-
row 2 2
%ENDBOUNDEDTABLE%
cell 5 3
|-
cell 6 1 cell 6 2 cell 6 3
%ENDBOUNDEDTABLE%

And when you change the tableclass to twikiboundedtable

%BOUNDEDTABLE{tableclass="twikiboundedtable" tablewidth="60%" columnwidths="60%, 30%, 10%" headerrows="1"}%
the presentation becomes:

Table 3

%BOUNDEDTABLE{tableclass="twikiboundedtable" tablewidth="60%" columnwidths="60%, 30%, 10%" headerrows="1"}%

cell 1 1 cell 1 2 cell 1 3
|-
cell 2 1 cell 2 2
%BOUNDEDTABLE{tableclass="boundedtable" columnwidths="80%, 20%"}%
T1 T2
|-
row 2 2
%ENDBOUNDEDTABLE% | |-
cell 3 1 cell 3 2 cell 3 3
|-
cell 4 1 cell 4 2 cell 4 3
|- | %BOUNDEDTABLE{tableclass="boundedtable" tablewidth="100%" columnwidths="40%, 60%"}%
T1 T2
|-
row 2 2
%ENDBOUNDEDTABLE%
cell 5 3
|-
cell 6 1 cell 6 2 cell 6 3
%ENDBOUNDEDTABLE%

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %INTERWIKIPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Extended table syntax with support for nested tables and CSS

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

  • Default boundedtable attributes
    • None

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip BoundedTablePlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/BoundedTablePlugin.txt Plugin topic
    data/TWiki/BoundedTablePlugin.txt,v Plugin topic repository
    lib/TWiki/Plugins/BoundedTablePlugin.pm Plugin Perl module
  • Test if the installation was successful:
    • the samples at the bottom of this page should appear like the pictures above

Plugin Info

Plugin Author: TWiki:Main.BramVanOosterhout
Plugin Version: 05 Nov 2005 (V1.000)
Change History:  
05 Nov 2005: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.0
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
License: GPL (GNU General Public License)
Benchmarks: GoodStyle 99%, FormattedSearch 99%, BoundedTablePlugin 99%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/BoundedTablePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/BoundedTablePluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/BoundedTablePluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins

-- TWiki:Main.BramVanOosterhout - 05 Nov 2005

Topic attachments
I Attachment History Action Size Date Who Comment
Compressed Zip archivetgz BoundedTablePlugin.tgz r3 r2 r1 manage 7.1 K 2006-07-04 - 04:36 BramVanOosterhout accept (class1 class2) multiple classes on a cell
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2006-07-04 - BramVanOosterhout
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.