Test:SimpleTable
From EcoReality
Revision as of 18:30, 2 July 2011 by Jan Steinman (Talk | contribs)
This is a demo of the parser extension SimpleTable.
SimpleTable allows you to easily display tabular data from other applications that is in CSV (Commas Separated Values) format. But it does not conform to CSV standards — in particular, you cannot have the field delimiter in any of the data. But for the simplest use described below, you don't have to worry about that.
Usage
To use this to quickly and simply make tables:
- Create your table in Numbers or Excel.
- Select all the cells and do "copy."
- Place <tab> and </tab> in the wiki page where you want the table.
- Paste the copied spreadsheet data in between the <tab> and </tab> tags.
Options
There are a number of options you can use to change a table's behaviour and presentation. These options go inside the opening <tab> tag.
- I have modified it so that it automatically has "class=sortable" to make little sort buttons for each column. To disable this, put "class=wikitable" in:
- <tab class=wikitable>... </tab>
- By default, it creates a table with no borders. To add borders, use "border=1" or some bigger number if you want thicker borders:
- <tab border=1>... </tab>
- EXPERT: You can change the field delimiter to several other characters, but this does not fully work properly, and should be avoided:
- <tab sep=comma>... </tab>
- The "head" option causes row or column headers (or both) to be bold:
- <tab head=top>... </tab>
- <tab head=left>... </tab>
- <tab head=topleft>... </tab>
Examples
Simplest, using copy from Apple Numbers
| 80 Grumman | 82 Vanagon | 85 Jetta | 91 Jetta | 91 Dodge | 96 Passat | notes | ||
| Valuation | ||||||||
| Original Cost | $6,000.00 | $1,500.00 | $1,000.00 | $3,700.00 | $5,000.00 | $7,500.00 | ||
| Improvements | $6,000.00 | $2,000.00 | ||||||
| Total Value | $12,000.00 | $1,500.00 | $3,000.00 | $3,700.00 | $5,000.00 | $7,500.00 | ||
| Market Value | $12,000.00 | $6,000.00 | $3,500.00 | $3,700.00 | $10,000.00 | $7,500.00 | ||
| Remaining Life | 10 | 10 | 10 | 10 | 10 | 10 | in years | |
| Kilometres | 254,872 | 183,205 | 247,938 | 336,107 | 266,437 | 333,838 | ||
| Est. Lifetime | 800,000 | 500,000 | 500,000 | 500,000 | 800,000 | 500,000 | kilometres | |
| Remaining Life | 545,128 | 316,795 | 252,062 | 163,893 | 533,563 | 166,162 | kilometres | |
| Cost/Year | $1,200.00 | $600.00 | $350.00 | $370.00 | $1,000.00 | $750.00 | ||
| Cost/Kilometre | $0.0220 | $0.0189 | $0.0139 | $0.0226 | $0.0187 | $0.0451 | ||
| Overhead | ||||||||
| Reg & Insurance | $514.00 | $513.00 | $514.00 | $514.00 | $463.00 | $514.00 | est for 85 Jetta & 96 Passat | |
| Maintenance | $500.00 | $500.00 | $500.00 | $500.00 | $500.00 | $2,244.72 | estimate; need 2008 actuals | |
| Last Year's Km | 336 | 1,384 | 0 | 5,557 | 7,195 | 7,500 | actual 2008, except Passat | |
| Annual Kilometres | 5,329 | 5,329 | 5,329 | 5,329 | 5,329 | 5,329 | average of 2008 actual + 10k | |
| Cost/Kilometre | $0.19 | $0.19 | $0.19 | $0.19 | $0.18 | $0.52 | ||
| Fuel | ||||||||
| Fuel Economy | 15 | 30 | 40 | 40 | 20 | 40 | miles per USG | |
| Fuel Economy | 15.68 | 7.84 | 5.88 | 5.88 | 11.76 | 5.88 | litres per 100km | |
| Fuel Cost | $1.45 | $1.45 | $1.45 | $1.45 | $1.45 | $1.45 | C$ per litre | |
| Cost/Kilometre | $0.23 | $0.11 | $0.09 | $0.09 | $0.17 | $0.09 | ||
| Total | ||||||||
| Cost/Kilometre | $0.44 | $0.32 | $0.29 | $0.30 | $0.37 | $0.65 | ||
| Scenarios | ||||||||
| As Is | $0.44 | $0.32 | $0.29 | $0.30 | $0.37 | $0.65 | ||
| Floor/Ceiling | ||||||||
| Exponential |
With borders, headers, and no sorting
| Column 1 | Column 2 | Column 3 | |
|---|---|---|---|
| Row 1 | Here is some data | and some more data | and yet more data. |
| Row 2 | Now is the time | for all good people | to mend their jeans. |
| Row 3 | There was an old lady | who swallowed | a fly. |
| Row 4 | You can use | wikitext in your table | if you wish. |
Column separators in data cause problems:
| Column 1 | Column 2 | Column 3 | ||
|---|---|---|---|---|
| Embedded commas cause problems | $1 | 000 | $2 | 000 |
| Embedded commas cannot be escaped | Here is some data | with columns separated by comma. I wonder\ | if | escaped commas work properly? |
| Embedded commas cannot be quoted | "$1 | 000" | "$2 | 000" |
| So it is best to not use other separators. |
