Log Message:
Turn an array of arrays of strings into a table for textmode display. Scales to terminal width and wraps cell contents.
Uses DokuWiki-style ':::' row-span and empty-cell col-span, but is otherwise separate from wiki syntax, so committing as its own thing. table(data[, line_color[, heading_color[, cell_color[, width]]])
Interesting... Can't wait to check that out! Sounds like something I might want to switch to in my Sports Stats code.
load('table.js');
var data = [['the','heading','row'],['the','next','row']]; // and so on
// data, line colour, heading colour, cell colour, width
var t = table(data, '\1h\1c', '\1h\1w', '\1n\1w', 79);
console.putmsg(t);
Can you specify cell size/width (so that, for example, box scores are all formatted the same when stacked over each other)?
Re: exec/load/table.js
By: Kirkman to echicken on Thu Oct 04 2018 18:41:53
Can you specify cell size/width (so that, for example, box scores are all formatted the same when stacked over each other)?
There isn't a good way to force a table or column width right now. This was made to automatically size to the terminal width. Cells in the same column in
a table are the same width of course, but separate tables with different contents may be different sizes.
It strips trailing whitespace off of cell contents. I might be able to change that, and then padding out cell contents with spaces might be one way to force a column width. Right now all you could do is front-pad with spaces, or pad one side or the other with some printable character (periods maybe).
Does it also do the left/right/center alignment (of table cells) thing that dokuwiki does?
Re: exec/load/table.js
By: Digital Man to echicken on Thu Oct 04 2018 19:56:36
Does it also do the left/right/center alignment (of table cells) thing that dokuwiki does?
Not yet; that's something I've been meaning to add.
Right now all you could do is front-pad with
spaces, or pad one side or the other with some printable character (periods maybe).
Sysop: | r00t |
---|---|
Location: | Newport Beach, CA |
Users: | 12 |
Nodes: | 6 (0 / 6) |
Uptime: | 231:47:20 |
Calls: | 144 |
Files: | 238 |
Messages: | 33,772 |