User:Fbstj/docs/tables

From The Coppermind
< User:Fbstj
Revision as of 21:47, 23 November 2018 by Fbstj (talk | contribs) (Fbstj moved page User:Fbstj/doc:tables to User:Fbstj/docs/tables without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

so here is a table in 'raw' wiki syntax:

this is the caption
this is a cell, it starts with a |
this is another cell and a third on the same row as the second, but on a different line
this is a cell: it starts with an ! this is a normal cell again and this is a third cell in that row but on the same line by using ||
to split header cells use !! on the same line
to apply attributes (or style) to a single cell you add the attributes after the | at the start of a line, and then add another | after the attributes:
| style="text-align: center;" | this is centered text this is centered text
the same attribute stuff can be applied to the ! cells but not to cells on the same line split by double ||
the trick comes when trying to use a template to generate a table or row to pass in to the template that you want a cell/row you cannot use the | character as that would split into two template arguments instead. so there is a special {{!}} code which makes a | character that doesn't act like a template argument splitter
this means we can use the {{row}} template, to more clearly split columns without the rigmarole of the |-
but to support header cells or cell styling the template needs extra arguments:
if you pass |pre=! it turns all the cells into cells
and to style a single cell you can use the preN parameter (N for the column number)
this also enables you to style cells with |pre3={{!}} style="font-weight: bold; " {{!}} like this