Difference between revisions for Playground / Table Markup Guide
| Version1 | Version2 | ||
|---|---|---|---|
| 1 | As of **!!(green)6.2!!**, Wacko introduces a flexible markup for data tables. Any kind of tables allowed by HTML5 can be created using this markup, from the most basic examples (e.g. simple rows of cells) to complex tables with full support for accessibility options. | 1 | As of **!!(green)6.2!!**, Wacko introduces a flexible markup for data tables. Any kind of tables allowed by HTML5 can be created using this markup, from the most basic examples (e.g. simple rows of cells) to complex tables with full support for accessibility options. |
| 2 |
|
2 | |
| 3 | {{toc numerate=1}} | 3 | {{toc numerate=1}} |
| 4 |
|
4 | |
| 5 | ===Table basics=== | 5 | ===Table basics=== |
| 6 | ====Cells==== | 6 | ====Cells==== |
| 7 | 7 | ||
| … | … | … | … |
| 136 | ^| John | 400Kg | 630Kg || | 136 | ^| John | 400Kg | 630Kg || |
| 137 | |# | 137 | |# |
| 138 | 138 | ||
| 139 |
=== |
139 | ===Cell Spans=== |
| 140 |
** |
140 | **Cell spans** are used to combine multiple cells or multiple headings vertically or horizontally and are created using the following [[TableMarkupReference attribute parameters]]: |
| 141 |
|
141 | |
| 142 |
##""||""(''span options'') |
142 | ##""||""(''span options'') Element content ""||""## |
| 143 |
|
143 | |
| 144 |
A **cell spanning multiple columns** is generated by prefixing the cell content with a ##( |
144 | A **cell spanning multiple columns** is generated by prefixing the cell content with a ##(colspan=''n'')## parameter, where ##''n''## is the number of columns to be spanned. The following example shows how to create a cell spanning two columns: |
| 145 |
|
145 | |
| 146 |
%% |
146 | %% |
| 147 |
#| |
147 | #| |
| 148 |
||( |
148 | ||(colspan=2) Cell spanning 2 columns | Cell 3 || |
| 149 | || Cell 4 | Cell 5 | Cell 6 || | 149 | || Cell 4 | Cell 5 | Cell 6 || |
| 150 | || Cell 7 | Cell 8 | Cell 9 || | 150 | || Cell 7 | Cell 8 | Cell 9 || |
| 151 | |# | 151 | |# |
| 152 | %% | 152 | %% |
| 153 | 153 | ||
| 154 | #| | 154 | #| |
| 155 |
||( |
155 | ||(colspan=2) Cell spanning 2 columns | Cell 3 || |
| 156 | || Cell 4 | Cell 5 | Cell 6 || | 156 | || Cell 4 | Cell 5 | Cell 6 || |
| 157 | || Cell 7 | Cell 8 | Cell 9 || | 157 | || Cell 7 | Cell 8 | Cell 9 || |
| 158 | |# | 158 | |# |
| 159 | 159 | ||
| 160 |
Spans can also be applied to rows. A **cell spanning multiple rows** is generated by prefixing the cell content with a ##( |
160 | Spans can also be applied to rows. A **cell spanning multiple rows** is generated by prefixing the cell content with a ##(rowspan=''n'')## parameter, where ##''n''## is the number of rows to be spanned. The following example shows how to create a cell spanning two rows: |
| 161 |
|
161 | |
| 162 |
%% |
162 | %% |
| 163 |
#| |
163 | #| |
| 164 |
||( |
164 | ||(rowspan=2) Cell spanning 2 rows | Cell 2 | Cell 3 || |
| 165 | || Cell 5 | Cell 6 || | 165 | || Cell 5 | Cell 6 || |
| 166 | || Cell 7 | Cell 8 | Cell 9 || | 166 | || Cell 7 | Cell 8 | Cell 9 || |
| 167 | |# | 167 | |# |
| 168 | %% | 168 | %% |
| 169 | 169 | ||
| 170 | #| | 170 | #| |
| 171 |
||( |
171 | ||(rowspan=2) Cell spanning 2 rows | Cell 2 | Cell 3 || |
| 172 | || Cell 5 | Cell 6 || | 172 | || Cell 5 | Cell 6 || |
| 173 | || Cell 7 | Cell 8 | Cell 9 || | 173 | || Cell 7 | Cell 8 | Cell 9 || |
| 174 | |# | 174 | |# |
| … | … | … | … |
| 178 | %% | 178 | %% |
| 179 | #| | 179 | #| |
| 180 | *| | Mon | Tue | Wed | Thu | Fri |* | 180 | *| | Mon | Tue | Wed | Thu | Fri |* |
| 181 |
|| 8-9 | |( |
181 | || 8-9 | |(rowspan=9) Outreach | |(rowspan=9) Outreach | || |
| 182 | || 9-10 | | | || <-- reduced by two columns | 182 | || 9-10 | | | || <-- reduced by two columns |
| 183 | || 10-11 | | | || | 183 | || 10-11 | | | || |
| 184 | || 11-12 | | | || | 184 | || 11-12 | | | || |
| 185 | || 12-13 | | | || | 185 | || 12-13 | | | || |
| 186 | || 13-14 | | | || | 186 | || 13-14 | | | || |
| 187 |
|| 14-15 |( |
187 | || 14-15 |(rowspan=3) CSCI 102 | CSCI 101 | CSCI 101 || |
| 188 | || 15-16 | | || <-- reduced by one column | 188 | || 15-16 | | || <-- reduced by one column |
| 189 | || 16-17 | | || | 189 | || 16-17 | | || |
| 190 | |# | 190 | |# |
| … | … | … | … |
| 192 | 192 | ||
| 193 | #| | 193 | #| |
| 194 | *| | Mon | Tue | Wed | Thu | Fri |* | 194 | *| | Mon | Tue | Wed | Thu | Fri |* |
| 195 |
|| 8-9 | |( |
195 | || 8-9 | |(rowspan=9) Outreach | |(rowspan=9) Outreach | || |
| 196 | || 9-10 | | | || | 196 | || 9-10 | | | || |
| 197 | || 10-11 | | | || | 197 | || 10-11 | | | || |
| 198 | || 11-12 | | | || | 198 | || 11-12 | | | || |
| 199 | || 12-13 | | | || | 199 | || 12-13 | | | || |
| 200 | || 13-14 | | | || | 200 | || 13-14 | | | || |
| 201 |
|| 14-15 |( |
201 | || 14-15 |(rowspan=3) CSCI 102 | CSCI 101 | CSCI 101 || |
| 202 | || 15-16 | | || | 202 | || 15-16 | | || |
| 203 | || 16-17 | | || | 203 | || 16-17 | | || |
| 204 | |# | 204 | |# |
| … | … | … | … |
| 208 | %% | 208 | %% |
| 209 | #| | 209 | #| |
| 210 | ?| Fruit production in the last two years |? | 210 | ?| Fruit production in the last two years |? |
| 211 |
*| |( |
211 | *| |(colspan=2) Apples |(colspan=2) Pears |* |
| 212 | *| | 2025 | 2026 | 2025 | 2026 |* | 212 | *| | 2025 | 2026 | 2025 | 2026 |* |
| 213 | ^| Mary | 300Kg | 320Kg | 400kg | 280Kg || | 213 | ^| Mary | 300Kg | 320Kg | 400kg | 280Kg || |
| 214 | ^| John | 400Kg | 630Kg | 210Kg | 300Kg || | 214 | ^| John | 400Kg | 630Kg | 210Kg | 300Kg || |
| … | … | … | … |
| 217 | 217 | ||
| 218 | #| | 218 | #| |
| 219 | ?| Fruit production in the last two years |? | 219 | ?| Fruit production in the last two years |? |
| 220 |
*| |( |
220 | *| |(colspan=2) Apples |(colspan=2) Pears |* |
| 221 | *| | 2025 | 2026 | 2025 | 2026 |* | 221 | *| | 2025 | 2026 | 2025 | 2026 |* |
| 222 | ^| Mary | 300Kg | 320Kg | 400kg | 280Kg || | 222 | ^| Mary | 300Kg | 320Kg | 400kg | 280Kg || |
| 223 | ^| John | 400Kg | 630Kg | 210Kg | 300Kg || | 223 | ^| John | 400Kg | 630Kg | 210Kg | 300Kg || |
| … | … | … | … |
| 227 | 227 | ||
| 228 | %% | 228 | %% |
| 229 | #| | 229 | #| |
| 230 |
||( |
230 | ||(colspan=2 rowspan=2) 2x2 |(colspan=2) 2x1 |(rowspan=2) 1x2 || |
| 231 |
||( |
231 | ||(rowspan=2) 1x2 | 1x1 || |
| 232 |
|| 1x1 | 1x1 |( |
232 | || 1x1 | 1x1 |(colspan=2) 2x1 || |
| 233 |
|# |
233 | |# |
| 234 |
%% |
234 | %% |
| 235 |
|
235 | |
| 236 |
#| |
236 | #| |
| 237 |
||( |
237 | ||(colspan=2 rowspan=2) 2x2 |(colspan=2) 2x1 |(rowspan=2) 1x2 || |
| 238 |
||( |
238 | ||(rowspan=2) 1x2 | 1x1 || |
| 239 |
|| 1x1 | 1x1 |( |
239 | || 1x1 | 1x1 |(colspan=2) 2x1 || |
| 240 |
|# |
240 | |# |
| 241 |
|
241 | |
| 242 |
|
242 | |
| 243 |
===Formatting text |
243 | ===Formatting text=== |
| 244 | 244 | ||
| 245 | You can use any kind of basic [[wackowiki:Doc/English/Formatting Wacko markup]] to render text within tables. | 245 | You can use any kind of basic [[wackowiki:Doc/English/Formatting Wacko markup]] to render text within tables. |
| 246 | The following example adds basic formatting to cell content: | 246 | The following example adds basic formatting to cell content: |
| … | … | … | … |
| 249 | #| | 249 | #| |
| 250 | ?| Using text formatting within tables |? | 250 | ?| Using text formatting within tables |? |
| 251 | || ##Monospaced## | //Italics// | **Bold** | __Underlined__ || | 251 | || ##Monospaced## | //Italics// | **Bold** | __Underlined__ || |
| 252 |
|| !!Highlighted!! | --Strikethrough-- |( |
252 | || !!Highlighted!! | --Strikethrough-- |(colspan=2) **//Bold italics//** || |
| 253 | |# | 253 | |# |
| 254 | %% | 254 | %% |
| 255 | 255 | ||
| 256 | #| | 256 | #| |
| 257 | ?| Using text formatting within tables |? | 257 | ?| Using text formatting within tables |? |
| 258 | || ##Monospaced## | //Italics// | **Bold** | __Underlined__ || | 258 | || ##Monospaced## | //Italics// | **Bold** | __Underlined__ || |
| 259 |
|| !!Highlighted!! | --Strikethrough-- |( |
259 | || !!Highlighted!! | --Strikethrough-- |(colspan=2) **//Bold italics//** || |
| 260 |
|# |
260 | |# |
| 261 |
|
261 | |
| 262 |
===A |
262 | ===Actions and images=== |
| 263 | 263 | ||
| 264 | Simple, content-generating [[Docs:UsingActions actions]] (including [[Docs:AddingImages images]]) can be added within table cells and headings. | 264 | Simple, content-generating [[Docs:UsingActions actions]] (including [[Docs:AddingImages images]]) can be added within table cells and headings. |
| 265 | 265 | ||
| … | … | … | … |
| 279 | || !!some colored text!! || | 279 | || !!some colored text!! || |
| 280 | |# | 280 | |# |
| 281 | 281 | ||
| 282 |
=== |
282 | ===Links=== |
| 283 | 283 | ||
| 284 | All the available options to create [[Docs:AddingLinks links]] can be used within table cells or headings: | 284 | All the available options to create [[Docs:AddingLinks links]] can be used within table cells or headings: |
| 285 | 285 | ||
| … | … | … | … |
| 293 | || Forced interwiki links: | [[Wikipedia:Unicode Unicode article on Wikipedia]] || | 293 | || Forced interwiki links: | [[Wikipedia:Unicode Unicode article on Wikipedia]] || |
| 294 | || External links: | http://www.example.com || | 294 | || External links: | http://www.example.com || |
| 295 | || Forced external links: | [[http://www.example.com Example.com]] || | 295 | || Forced external links: | [[http://www.example.com Example.com]] || |
| 296 |
|| Image links: | file:/ |
296 | || Image links: | file:/IMG_20250615_134454_135-min.jpg?600 || |
| 297 | |# | 297 | |# |
| 298 | %% | 298 | %% |
| 299 | 299 | ||
| … | … | … | … |
| 306 | || Forced interwiki links: | [[Wikipedia:Unicode Unicode article on Wikipedia]] || | 306 | || Forced interwiki links: | [[Wikipedia:Unicode Unicode article on Wikipedia]] || |
| 307 | || External links: | http://www.example.com || | 307 | || External links: | http://www.example.com || |
| 308 | || Forced external links: | [[http://www.example.com Example.com]] || | 308 | || Forced external links: | [[http://www.example.com Example.com]] || |
| 309 |
|| Image links: | file:/ |
309 | || Image links: | file:/IMG_20250615_134454_135-min.jpg?600 || |
| 310 |
|# |
310 | |# |
| 311 |
|
311 | |
| 312 |
=== |
312 | ===HTML=== |
| 313 | 313 | ||
| 314 | You can also use [[Docs:UsingHTML embedded HTML]] in table elements: | 314 | You can also use [[Docs:UsingHTML embedded HTML]] in table elements: |
| 315 | 315 | ||
| … | … | … | … |
| 317 | #| | 317 | #| |
| 318 | ?| Embedding HTML within tables |? | 318 | ?| Embedding HTML within tables |? |
| 319 | || Here's some superscript: a^^2+1^^ || | 319 | || Here's some superscript: a^^2+1^^ || |
| 320 |
|| And here's some subscript too: a |
320 | || And here's some subscript too: a,,2k,, || |
| 321 | || I love acronyms: (?WYTIWYG What You Think Is What You Get?) || | 321 | || I love acronyms: (?WYTIWYG What You Think Is What You Get?) || |
| 322 | |# | 322 | |# |
| 323 | %% | 323 | %% |
| … | … | … | … |
| 325 | #| | 325 | #| |
| 326 | ?| Embedding HTML within tables |? | 326 | ?| Embedding HTML within tables |? |
| 327 | || Here's some superscript: a^^2+1^^ || | 327 | || Here's some superscript: a^^2+1^^ || |
| 328 |
|| And here's some subscript too: a |
328 | || And here's some subscript too: a,,2k,, || |
| 329 | || I love acronyms: (?WYTIWYG What You Think Is What You Get?) || | 329 | || I love acronyms: (?WYTIWYG What You Think Is What You Get?) || |
| 330 | |# | 330 | |# |
| 331 | 331 | ||
| 332 |
=== |
332 | ===Styling=== |
| 333 | The table markup introduces a new [[TableMarkupReference style selector]]. CSS style options can be added to any element by enclosing them within **single braces**, right before the element content, e.g.: | 333 | The table markup introduces a new [[TableMarkupReference style selector]]. CSS style options can be added to any element by enclosing them within **single braces**, right before the element content, e.g.: |
| 334 |
##""||""{''style options''} |
334 | ##""||""{''style options''} Element content ""||""## |
| 335 | 335 | ||
| 336 | For example, to render a cell with **red background** and **white text color**, you can do the following: | 336 | For example, to render a cell with **red background** and **white text color**, you can do the following: |
| 337 | 337 | ||
| … | … | … | … |
| 391 | 391 | ||
| 392 | %% | 392 | %% |
| 393 | #| | 393 | #| |
| 394 |
?| |
394 | ?| Give priority |? |
| 395 |
||( |
395 | ||(colspan=2 rowspan=2 bgcolor=pink) 2x2 |(colspan=2 bgcolor=lightblue) 2x1 |(rowspan=2 bgcolor=lightyellow) 1x2 || |
| 396 |
||( |
396 | ||(rowspan=2 bgcolor=lightyellow) 1x2 |(bgcolor=darkslategray) !!(white)1x1!! || |
| 397 |
|| |
397 | ||(bgcolor=lightblue) 1x1 |(bgcolor=darkslategray) !!(white)1x1!! |(colspan=2 bgcolor=pink) 2x1 || |
| 398 |
|# |
398 | |# |
| 399 |
%% |
399 | %% |
| 400 |
|
400 | |
| 401 |
#| |
401 | #| |
| 402 |
?| |
402 | ?| Give priority |? |
| 403 |
||( |
403 | ||(colspan=2 rowspan=2 bgcolor=pink) 2x2 |(colspan=2 bgcolor=lightblue) 2x1 |(rowspan=2 bgcolor=lightyellow) 1x2 || |
| 404 |
||( |
404 | ||(rowspan=2 bgcolor=lightyellow) 1x2 |(bgcolor=darkslategray) !!(white)1x1!! || |
| 405 |
|| |
405 | ||(bgcolor=lightblue) 1x1 |(bgcolor=darkslategray) !!(white)1x1!! |(colspan=2 bgcolor=pink) 2x1 || |
| 406 | |# | 406 | |# |
| 407 | 407 | ||
| 408 | ===Adding style through classes=== | 408 | ===Adding style through classes=== |
| … | … | … | … |
| 449 | 449 | ||
| 450 | ===Referring to elements: the ##id## attribute=== | 450 | ===Referring to elements: the ##id## attribute=== |
| 451 | 451 | ||
| 452 |
##id## attributes are used to refer to unique elements in a page and to provide an anchor for styling and linking. You can specify an ##id## for any table element by using the ##(i |
452 | ##id## attributes are used to refer to unique elements in a page and to provide an anchor for styling and linking. You can specify an ##id## for any table element by using the ##(id=''id'')## parameter. |
| 453 | 453 | ||
| 454 | For example, the following markup creates a table with the ##id## "main_table" containing two cells with ##id##'s "cell_1" and "cell_2" | 454 | For example, the following markup creates a table with the ##id## "main_table" containing two cells with ##id##'s "cell_1" and "cell_2" |
| 455 | 455 | ||
| 456 | %% | 456 | %% |
| 457 | #| | 457 | #| |
| 458 |
!|(i |
458 | !|(id=main_table)|! |
| 459 | ?|Using id to refer to table elements|? | 459 | ?|Using id to refer to table elements|? |
| 460 |
||(i |
460 | ||(id=cell_1)This cell can be referred to by using the ##cell_1## id|| |
| 461 |
||(i |
461 | ||(id=cell_2)This cell can be referred to by using the ##cell_2## id|| |
| 462 | |# | 462 | |# |
| 463 | %% | 463 | %% |
| 464 | 464 | ||
| 465 | #| | 465 | #| |
| 466 | !|(i:main_table)|! | 466 | !|(i:main_table)|! |
| 467 | ?|Using id to refer to table elements|? | 467 | ?|Using id to refer to table elements|? |
| 468 |
||(i |
468 | ||(id=cell_1)This cell can be referred to by using the ##cell_1## id|| |
| 469 |
||(i |
469 | ||(id=cell_2)This cell can be referred to by using the ##cell_2## id|| |
| 470 | |# | 470 | |# |
| 471 | 471 | ||
| 472 | ===Accessibility options=== | 472 | ===Accessibility options=== |
| … | … | … | … |
| 515 | ====Heading scope==== | 515 | ====Heading scope==== |
| 516 | 516 | ||
| 517 | To be semantically correct and accessible to users with non-visual browsers, headings should contain scope attributes describing the cell range they refer to. | 517 | To be semantically correct and accessible to users with non-visual browsers, headings should contain scope attributes describing the cell range they refer to. |
| 518 |
* Column heading scopes can be specified using the ##( |
518 | * Column heading scopes can be specified using the ##(scope=col)## parameter in the corresponding column heading; |
| 519 |
* Row heading scopes can be specified using the ##( |
519 | * Row heading scopes can be specified using the ##(scope=row)## parameter in the corresponding row heading; |
| 520 | 520 | ||
| 521 | The following example shows how to correctly add column and row scopes to a table to make it accessible: | 521 | The following example shows how to correctly add column and row scopes to a table to make it accessible: |
| 522 | 522 | ||
| 523 | %% | 523 | %% |
| 524 | #| | 524 | #| |
| 525 |
|
||
| 526 | ?|Table 1: Company data|| | 525 | ?|Table 1: Company data|| |
| 527 | |[| | 526 | |[| |
| 528 |
*| |( |
527 | *| |(scope=col)Employees|(scope=col)Founded|* |
| 529 | |#| | 528 | |#| |
| 530 | ^|(o=row)ACME Inc|1000|1947|| | 529 | ^|(scope=row)ACME Inc|1000|1947|| |
| 531 | ^|(o=row)XYZ Corp|2000|1973|| | 530 | ^|(scope=row)XYZ Corp|2000|1973|| |
| 532 | |# | 531 | |# |
| 533 | %% | 532 | %% |
| 534 | 533 | ||
| 535 | #| | 534 | #| |
| 536 | !|(u:The number of employees and the foundation year of some imaginary companies.)|! | ||
| 537 | ?|Table 1: Company data|? | 535 | ?|Table 1: Company data|? |
| 538 | |[| | 536 | |[| |
| 539 |
*| |( |
537 | *| |(scope=col)Employees|(scope=col)Founded|* |
| 540 | |#| | 538 | |#| |
| 541 |
^|( |
539 | ^|(scope=row)ACME Inc|1000|1947|| |
| 542 |
^|( |
540 | ^|(scope=row)XYZ Corp|2000|1973|| |
| 543 |
|# |
541 | |# |
| 544 |
|
542 | |