Folks, Here is a dump of my draft document, it is in no way finished, but will give you a feel for what I am trying to document. Please tell me what we should include.
I will try and show if then else while until etc.. in the long run Regards Tony 1. SequenceOne step following anotherWith sequence it commonly stops when you reach the bottom of a tiddler - 1.1 Left to right, Top then down the wiki text, the first item is displayed above the next etc... down the page Note new line vs paragraphs - 1.2 Using list and a filter to get a sequence of items displayed or acted on Using a list for sequence it commonly stops when the members of the list finish/are exhausted, it then moves to the next line of the current tiddler until you reach the bottom of a tiddlerThis can be impacted by "Includes" see below.2. IterationRepeat for each item in a set, ending when no more items are in the set or some condition is true/false - 2.1 Using the list widget with a filter that has 0 or more members - 2.2 An iteration can be ordered using sorting - 2.3 There are many ways to re-iterate, and you can re-iterate Macros, with transclusions and a lot more, most iterations will end with no more members in a list or some other condition. 3. SortingChoosing the order in which more than one item is listed - 3.1 Filtered lists permit the addition of the sort[fieldname] filter operator which can be used to sort the final list Default is title or for tagged items the order in which they appear in the tags list field!sort[fieldname] will reverse the order - 3.2 Used with iteration to support the order in which the items are acted on 4. Selection/Decisionusing some condition to determine whether to display something or not - 4.1 A list field will list is membership if there are members. otherwise will not - 4.2 If you need to determine if there are one or more (not Zero members), or any other number of something You can use the limit[n] filter operator so that limit[1] will display only once if there is one or more members?Limit[0] works??Use ? starting line for a different class - 4.3 If you want to test there is no members? The emptyMessage is available on the list widget and emptyValue on the set widget - 4.4 What if you want to list the non-members Using the ! with the filter operatorsNote default set all regular tiddlers so perhaps filter based on another condition first - 4.5 The reveal widget allows a section to be displayed according to a match including comparisons Reveal widgets can also be nested - 4.6 Simple Comparisons - 4.7 Inclusion/exclusion and other selection tests - The do nothing case or filter but exclude - A tiddler but not those it is the prefix of [prefix[tiddlername]suffix[tiddlername]] is both its prefix and its suffix - 4.8 Selection and decisions can be made based on values that are in variables, Tiddlers, fields and more so review *Using Values and variables* or *Setting Values and variables*5. NestingThis is the process where one set of actions occur within another set of actions, With tiddlywiki nesting can occur for many levels "deep"This is how Case and Recursion below, amongst other structures are possible. - 5.1 One implicit example of nesting is a Single ListWidget <http://127.0.0.1:8084/TW5Reference#ListWidget> in a particular tiddler, it is in fact nesting its result in the existing tiddler - 5.2 In most cases anything you write can be nested within something else, and as many deep as you choose. However if you nest your current tiddler in the current tiddler you *may* face infinite recursion (like between two mirrors)See 7.x Recursion for intentional use of this ability - 5.3 Example Nesting list widgets <$list filter="filter1"> Do this for each filter1 case <$list filter="filter2"> Do this for each filter2 case <$list filter="filter3"> Do this for each filter3 case <$list filter="filter4"> Do this for each filter4 case </$list> </$list> </$list> </$list> *Notes:* - If the number of levels of nesting can vary or is large or unknown using *recursion* may be a better solution. - If transclusion or macro are used to *include* additional content these are in effect nested where they are included, and may contain other nesting themselves. - Each filter applies to the CurrentTiddler <http://127.0.0.1:8084/TW5Reference#CurrentTiddler> as determined by the previous ListWidget <http://127.0.0.1:8084/TW5Reference#ListWidget> unless a variable=*variablename* is set. - Each filter starts with an assumption you are filtering from all tiddlers, so use a variable or currentTiddler value from the previous List widget for logically nested lists. 6. CaseWhen you want something to occur differently for each case or member in a set6.1 A simple list allows you to do something for each member in a list which is a simple example of the "Case" structure.In the following example each member of the set becomes the current tiddler and everything in "Do this for this case" will be applied to each tiddler. <$list filter="yourfilter"> Do this for each case </$list> 6.2 Treating specific cases differentlynote in the below skeleton that the "specific case" tests are nested at the same level within the "yourfilter" outer listWidget <$list filter="yourfilter"> Do this for each case <$list filter="specificcase1filter"> Do this for each specificcase </$list> <$list filter="specificcase2filter"> Do this for each specificcase2 </$list> </$list> very sophisticated case structures can be built with the power of each list filter, emptyMessageexamples to follow - One statement for a subgroup or list of values - Multiple actions for each case 7. RecursionA process calling itself - 7.1 Using ListWidgets <http://127.0.0.1:8084/TW5Reference#ListWidgets> in a tiddler or macro to call itself allows you to perform recursive loops For example building a TableOfContents <http://127.0.0.1:8084/TW5Reference#TableOfContents> which list the tiddlers tagging the top tiddler, then all tiddlers tagging those, then all tiddlers tagging those...The advantage of the list widget is it typically finishes after the last item in the list is processed, ensuring you eventually exit all recursion levels See WikiPedia on Recursion <http://en.wikipedia.org/wiki/Recursion>8. Includesincluding content in one location that is found in another - 8.1 Macros - 8.2 Transclusion 9. Using Values and variablesSet/Vars/ParamsEmptyValue <http://127.0.0.1:8084/TW5Reference#EmptyValue>/EmptyMessage <http://127.0.0.1:8084/TW5Reference#EmptyMessage>Auto seting in liststitles of tiddlers vs pseudo titles from lists10 Setting Values and variablesOften values and variables can be set in the context they are used as seen in *Using Values and variables*, however we often want the user to supply information for our Values and Variables - Select - Checkbox - Edit - 11. Accessing last or previous values On Monday, July 2, 2018 at 9:05:52 PM UTC+10, TonyM wrote: > > Evan of formulas fame has also provided logical operators you can use but > it can be achived with a set of listwidgets and filters with the else > handled buy using the same filter with negation using ! > > Even using the emptyMessage in list and emptyVale in set widgets helps. > > You can nest list widgets in any combination you want. I have half written > a guide on this, tw equivalents to normal code structures, I can share the > draft. > > It takes a little to learn the filter equivalent of if tests but once > mastered they can be more powerful because they are not only logical > operators but act on sets of titles (which can be litteral values not just > tiddler titles). > > One difference is tw does not favor simple true false test as much because > what it offers is designed to respond to tiddlers, tags and fields and is > thus much richer. > > Providing some simpler tests may assist users. > > Regards > Tony > > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/965a609f-1d75-4f84-bb8e-11394c3de537%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.