I can probably write a wikiparser which is similar to the core parser for "text/csv" files. The way I envision it, you would have the tokens delimiting where the block begins and ends, and immediately after the opening delimiter, an additional string which identifies (a) the major delimiter character (commas, tabs, tildes, etc.) (b) the "paired escape" characters, if any (for instance, in some variants of CSV, you can enclose an entry in double-quotes and a comma between them will not be taken as a delimiter but as part of the data) (c) the "single escape" character, if any (for instance, if you want a comma following a backslash to be read as a comma in the data rather than a delimiter.)
I have at least two questions, however:
1) This isn't an existing "type", not the way "text/csv" is, nor is it likely to be. Does this make it inappropriate to use the existing typeblock syntax for it?
2) Even if it's okay to use the typeblock syntax for a non-standard "type", does the idea of having a "control" string at the beginning defining how the rest of the block is to be read violate the intent of typeblock syntax?
A bonus question: is this the sort of discussion I should start on Github, rather than on the group?
$$$text/csv
,,
1,2
3,4
$$$
you see that table of comma-separated values gets neatly displayed as a table. I frequently get data that I would really like to see as a scrollable table, but it's separated by tildes or tabs rather than commas.
Jed -
What do you think would be the advantage of implementing it as a widget, rather than as a parser for a ContentType?
var columns = lineText.split(",");var columns = lineText.split(/,|~|\t/);Tobias - Yes, the intent is to display a section of tab-separated values or tilde-separated values as a table within a scrollable widget, just as TiddlyWiki already does out of the box for comma-separated values. If you put the following text in a tiddler:
$$$text/csv
,,
1,2
3,4
$$$
you see that table of comma-separated values gets neatly displayed as a table. I frequently get data that I would really like to see as a scrollable table, but it's separated by tildes or tabs rather than commas.
$$$text/csv(separator:"~", option-foo:{{config!!value}}, option-bar:<<config-variable>>)
,,
1,2
3,4
$$$What do you think would be the advantage of implementing it as a widget, rather than as a parser for a ContentType?
Introduce vocabulary parameter to wikitext content type
https://github.com/Jermolene/TiddlyWiki5/issues/345
I put in a pull request:
basic vocab stuff - includes changes to wikiparser by buggyj · Pull Request #629 ·
https://github.com/Jermolene/TiddlyWiki5/pull/629
which lead to my flexitype plugin which is on bjtools:
http://bjtools.tiddlyspot.com/
It allows options to be passed to parsers
| Part of this is selfish because I have been pushing to move away from using something special about the tiddler containing the information to determine how it is handled to making whatever uses the information be in charge of interpreting it.
Well, here's the thing: one of the uses I put the TiddlyWiki to is a "to-do list", where I record (sometimes in very small snatches of time) tasks that fall into my work domain, which I get from a table that is distributed as an Excel spreadsheet. And to be clear, we're talking about "a table" in the sense of a 1990's web guru using tables for making elements line up on the page, not something that could be read programmatically.
If I have a typeblock parser which reads the TSV format you get from copy-pasting, I can copy and paste each section of the table relevant to me into a tiddler, put the typeblock markers around it, and poof! The tiddler contains a table just as readable as the one I got it from, for just a few seconds effort!
It seems like the widget style you propose would require that each task be represented by TWO tiddlers: one for the data, one for the presentation of the data. That seems overkill, because there's only one place that each section of data needs to be read and only one way that it needs to be read.