Rec format for a list to manipulate with wikitext tools?

67 views
Skip to first unread message

Mat

unread,
Sep 16, 2018, 12:02:06 PM9/16/18
to TiddlyWiki
Asking for advice;

What is a good format that can be easily manipulated in TW for the following content.

I want a list data corresponding to an arbitrary amount of tiddlers. Each item has a specified amount of data such as;
  • tiddler title
  • modification date
  • meta data (i.e fieldvalue from a field named meta)
  • version (i.e fieldvalue from a field named version)

The "meta data" is arbitrary whereas the other data is restricted to the usual formats with regard to those fields in tiddlers. It is OK to restrict "meta data", e.g to say it must not contain special characters or that it has a maximum number of characters, etc. Overall, many tiddlers will miss some of the data.

Now I want to be able to manipulate this data using wikitext ideally. TW does not have a set of user tools to e.g manipulate json as far as I know. I come to this from an end user perspective so I'm limited to e.g the "split before" filter operator to separate out stuff from a text.

My question is... what is the optimal format for such a list? What delimiters should be used between the items and between their respective fields? Should the items perhaps be put in different fields of the listing tiddler? Some kind if table? Data tiddlers? Is it just very problematic with my wikitext limitation to manipulate it? How else?

I understand my question is vague and I'm likely missing to state some conditions for the context of it, but I'm still interested to hear what you have to say.

Thank you!

<:-)

Mark S.

unread,
Sep 16, 2018, 12:36:19 PM9/16/18
to TiddlyWiki
I don't know what you mean by "a list data". Do you mean some type of list field?

I don't know what you mean by "wikitext" only. Are you including or excluding Widgets?

It might help to understand the reasons behind your suggested limitations.

Have fun,
-- Mark

Mat

unread,
Sep 16, 2018, 3:23:55 PM9/16/18
to TiddlyWiki
Thanks for reply Mark

I don't know what you mean by "a list data". Do you mean some type of list field?

Typo. I meant a "list of data". To give an example;

[[tid A]] 234234 [[meta data for tid A]] [[]]
[[tid B]] 546235 [[previous tid had no version but this one does]] [[version 3.5]]
...

So in this case the each "item" has four pieces of information. It is just a listing of data but what the exact data is can be controlled.


I don't know what you mean by "wikitext" only. Are you including or excluding Widgets?

Yes, all tools provided by TW. This restricition is because I'm pretty affluent "in TW" but I don't know e.g js.
 

It might help to understand the reasons behind your suggested limitations.

The background is that Jed and I are working on TWederation. The purpose behind this particular issue is that I want users to get a "pre peek" at what tiddlers he will import if he decides to use a particular "fetch filter". So to get this "peek", the user first imports this supposed "list of data" containing meta-data about the to-be-imported tiddlers. It is the format of this list that I'm asking about. I will then use this list and present the data in some nice way. But I am limited to work with this data using "TW tools" so the list should ideally be in some easy-to-work-with format. The problem is that if the list is in a format where manipulating it demands knowledge beyond TW then I, and many other TW users, cannot easily manipulate its content (due to lack of coding knowlege). However, if anyone has a good insight or a strong argument for why the list ought to be formated in some certain way, then I'm happy to hear about it. 

<:-)

Mark S.

unread,
Sep 16, 2018, 4:04:51 PM9/16/18
to TiddlyWiki
Are you getting them in sets of data 4 at a time, or  like a giant listing?

In the basic, set of 4 case, you can use the nth operator like this:

<$set name="myList" value="[[tid A]] 234234 [[meta data for tid A]] [[]] ">
<$list filter="[enlist
<myList>nth[2]]">
Item: <
<currentTiddler>><br/>
</$list>
</$set>

The problem is, if you try this, is that empty [[]] field will disappear. This will happen if any of your fields are empty. So you might need to have any fields that could be empty prefixed with some indicator value (e.g. "m:my meta data") and then use the removeprefix operator to present it.

I'm also a little nervous that your list might "sort" itself if you apply any other operations first. I'm not sure that the order of the list items is guaranteed for every browser. So you might have to prefix all the fields just to be sure.

-- Mark

Mat

unread,
Sep 16, 2018, 4:33:16 PM9/16/18
to TiddlyWiki
Are you getting them in sets of data 4 at a time, or  like a giant listing?

I can request that Jed make them come in whatever format is useful (if it doesn't put a lot of burden on him of course) 

In the basic, set of 4 case, you can use the nth operator like this:

<$set name="myList" value="[[tid A]] 234234 [[meta data for tid A]] [[]] ">
<$list filter="[enlist
<myList>nth[2]]">
Item: <
<currentTiddler>><br/>
</$list>
</$set>

The problem is, if you try this, is that empty [[]] field will disappear. This will happen if any of your fields are empty.

LOL, I implemented that exact idea just earlier today!

 
So you might need to have any fields that could be empty prefixed with some indicator value (e.g. "m:my meta data") and then use the removeprefix operator to present it.

Good idea. It gave me the idea to use the string "&nbsp;" (i.e a space character) so it can't be seen if it is written out. I just added this to the implementation.

 
I'm also a little nervous that your list might "sort" itself if you apply any other operations first. I'm not sure that the order of the list items is guaranteed for every browser. So you might have to prefix all the fields just to be sure.

I don't seem to get that problem. What I'm more concerned with is if the whole idea with the proposed format is "bad" for some reason. Maybe the answer is simply that it will do the job - but maybe it is, for example, too fragile and will open up for problems in some cases I can't think of.

BTW as you'll see in the implementation, I did't use line breaks as a delimiter but instead an ugly %%%. I wish I could use linebreaks (for optics) but they disappear when I use 

<$action-listops $tiddler='peek-list' $field="text"
                  $subfilter="+[remove
<tid>]"/>

<:-)
Reply all
Reply to author
Forward
0 new messages