Wikipedia talk:Table: namespace and editor
Different markup
[edit]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²]] Foo [[Gothenburg]] 478,055 451 [[square kilometre|km²]] - [[Malmö]] 267,171 156 [[square kilometre|km²]] 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("{| {{subst: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, because it still uses the HTML table concept. ("What's a header?")
- Also, how does yours handle cell styles, headers, spanning rows/columns, background colors, etc? - Omegatron 16:25, Mar 12, 2005 (UTC)
Spanning columns and headers could be done this way (for example):
A B C D ============= 0 1 2 3 4 [- 5 -] E F G H ============= 6 7 - 8 9 10 11 12
A | C | D | E |
---|---|---|---|
0 | 1 | 2 | 3 |
4 | 5 | ||
E | F | G | H |
6 | 7 | 8 | |
9 | 10 | 11 | 12 |
Style settings for individual cells would be difficult -- you pretty much need a delimiter-based syntax (for example using pipes) for that. It could be done by placing it in front of the cell data, like this: |align:center| 5
or |highlight align:center| 5
. That way, a complexly formatted table would still require complex code, but the common case would be simple :)
It would, by the way, be nice to have per-column properties by adding a line at the top (this is one feature the current table syntax is missing):
column style: align:left align:center highlight align:right align:left width:230px
- Fredrik | talk 17:01, 12 Mar 2005 (UTC)
- Yes, that would certainly be nice. And that's where the pipe syntax misses; it's just an abbreviated version of the HTML table commands, which are not meant for ease of use and newbies.
- This would still have problems with large tables wrapping and becoming hard to edit. I still think a table namespace and editor with at least a non-wrapping textarea and templates for whatever commands we end up using would be useful here.
- Should we move this to the comments section? - Omegatron 00:58, Mar 16, 2005 (UTC)
Nice idea, but I think it could do with some extra work. E.g., what do you think of an interactive way of merging two cells in this editor? Like a way to move the boundary between two cells (with the mouse?) to make it merge with another boundary, and hence create one cell where it previously were two (and similarly create new boundaries...) Further, for every cell there might be drop down menus where you could change background color, widths/heights... you-name-it. \Mike(z) 21:52, 20 Apr 2005 (UTC)
- Nice. Keep thinking. That's clearly the part that needs the most work. - Omegatron 23:17, Apr 20, 2005 (UTC)
Structured data in MediaWiki
[edit]A broader solution to the same problem is m:Wikidata, which I am presently implementing. It will include the ability to add arbitrary structured data to wiki pages and edit it using a forms based editing approach. I therefore recommend holding off on implementing a table-extraction based solution.--Eloquence* 08:55, Apr 23, 2005 (UTC)
- How is Wikidata coming along? (SEWilco 17:36, 9 May 2007 (UTC))
GPL JS spreadsheet
[edit]Maybe a GPL'ed Javascript interface would help[1], for the people willing to use it. (SEWilco 02:44, 12 May 2007 (UTC))
Still needed?
[edit]Is a Javascript table editor still needed? Should it be incopreated into WikEd? —Dispenser 06:31, 10 July 2007 (UTC)