Page MenuHomePhabricator

Easier and better alignment within Wiki Tables
Open, NormalPublic


Author: D.U.Thibault

Right now, specifying alignment within Wiki tables is somewhat painful, what
with having to type <nowiki>align="right"|</nowiki> or some such in front of
every cell.

The wish is to be able to specify, within a table's block of headers, the data
column alignments once, in compact notation. We'd also like not only
right/center/left alignment but also number alignment (on the number's decimal
separator, even for scientific notation). Something like:

<nowiki>{| border="1" cellpadding="2" [...]
datalign="left"| Header1 datalign="number"| Value

In this example, the two headers simultaneously defined the alignment to use for
any following data cells (the first two columns, anyway). A later block of
headers would reset the data alignment instructions, obviously. These settings
would be locally overridable (on a per-cell basis) by the usual
<nowiki>align="whatever"|</nowiki> instructions.

Version: unspecified
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Normal.Nov 21 2014, 6:53 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz418.
bzimport added a subscriber: Unknown Object (MLST).
bzimport created this task.Sep 7 2004, 6:09 PM
hashar added a comment.Sep 8 2004, 5:39 AM

maybe have a look at the <col> html tag. I have no idea if it's still
valid xhtml though.

zigger wrote:

See also bug 986, which requests the HTML tags COL, COLGROUP, TBODY and THEAD. wrote:

This functionality would be handled by <colgroup> and <col>. They are valid in HTML5, which is the future (XHMTL2.0 is dead). Also totally stale.

*** This bug has been marked as a duplicate of bug 986 ***

TheDJ reopened this task as Open.EditedFeb 1 2016, 12:43 PM
TheDJ added a subscriber: TheDJ.


As detailed in T2986#1649109, the properties text-align and vertical-align (which are the corner stone of this request), are not actually assignable by way of the COL or COLGROUP elements.

Instead, I think that in order to properly solve this, we would likely require a form of T483 to target the <td>'s with selectors. Possibly combined by an extension to the wikicode syntax ?

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 1 2016, 12:43 PM
mxn added a subscriber: mxn.Sep 3 2017, 5:09 AM
Restricted Application added a subscriber: jeblad. · View Herald TranscriptSep 3 2017, 5:09 AM
Nirmos added a subscriber: Nirmos.Sep 3 2017, 6:50 AM

Should this be closed once TemplateStyles is deployed?

I don't think TemplateStyles is going to solve the root problem. Sure, theoretically it will give the ordinary users much more flexibility in styling their tables, but it isn't reasonable to expect that most will want to deal with full-blown CSS. Currently, the best way of achieving per-column alignment seems to be defining specific classes that should cover all possible cases: col-1-center, col-2-right, etc., and then adding them to the table header, e.g. {| class="wikitable col-3-right col-4-right". This is cumbersome, especially for larger tables, but at least it doesn't require technical knowledge from the ordinary editors.

MGChecker added a subscriber: MGChecker.