Jump to content

Wikipedia talk:Table: namespace and editor

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Omegatron (talk | contribs) at 16:25, 12 March 2005. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Less difficult to learn and hard to remember markup; more usability. The current table markup is harder to use than it needs to be.

Maybe something like the following:

<table>
City            Population   Area                               Something
[[Stockholm]]   761,721      188 [[square kilometre|km&sup2;]]  Foo
[[Gothenburg]]  478,055      451 [[square kilometre|km&sup2;]]  -
[[Malmö]]       267,171      156 [[square kilometre|km&sup2;]]  Bar
</table>

which of course would be converted to this:

City Population Area Something
Stockholm 761,721 188 km² Foo
Gothenburg 478,055 451 km²
Malmö 267,171 156 km² Bar

(For reference, here's the quick Python script I wrote to convert it to the existing table markup:)

def tablify(src):
    o = []
    o.append("{| {{prettytable}}\n")
    for line in open(src).readlines():
        row = filter(len, [x.strip() for x in line.split("  ")])
        if not row:
            continue
        o.append("|-\n")
        for cell in row:
            if cell == "-":
                cell = ""
            o.append("| " + cell + "\n")
    o.append("|}")
    return "".join(o)

Some more syntax would of course be needed so you could set style attributes and create cells that span more than one column. Fredrik | talk 15:52, 12 Mar 2005 (UTC)

Well there's already pipe syntax, which shortens the code, but doesn't really improve much on usability for newcomers. ("What's a header?") How does yours handle cell styles, headers, spanning rows/columns, background colors, etc? - Omegatron 16:25, Mar 12, 2005 (UTC)