List of tiddlers and their associated fields

@Scott_Sauyet thanks for your considered feedback.

The difference between us is my non-locality is supported by standard variable names such as I always code for acting on currentTiddler, and always use filename both in the function name and variable. In a sense it may be non-local but it becomes global.

  • Yes there is, multiple ways and I use them a lot, but something not everyone has realised yet is; “the key input can be the title given it by the filter” it is placed within. I think I need to document that separately.
    • see how op.fields is responding to the current title, in this case currentTiddler
  • Parameters can be passed as for macros <<function var:"val">>
  • Parameters can be passed as for operators [function[val]]>> [function<varname>,{!!fieldname}]>> etc…
    • The filters title is fed into the operator
    • All variables are available in the function unless overidden with a parameter name.
    • I think there is another way I can’t remember right now :frowning_face: I remember :grinning_face_with_smiling_eyes:
      • Calling with macrocall and transclude widgets.
      • Also within the backtick attributes, as variables or filter operators.

Here is my rewrite of your code, the way I would do it. Changed the tag for more data. The prior example was to replicate the source in the topic.

\function tagged.list(tag) [tag<tag>]
\function op.fields() [fields[]prefix[op]] -[[text]] -[[title]]
\function fieldname-title() [<fieldname>sentencecase[]]
\function fieldname-value() [all[current]get<fieldname>]

<$list filter="[tagged.list[Filter Operators]]">
<$link/>
<ul>
<$list filter="[<currentTiddler>op.fields[]]" variable=fieldname>
<li><<fieldname-title>>: <<fieldname-value>></li>
</$list>
</ul>
</$list>
  • tag. List[] is unnecessary but it demonstrates a parameter
  • fieldname-title and fieldname-value are used as variables, with the added advantage they are shown as text, they imply thay act on fieldname (to me at least)
    • I removed the parameter name because the value is obtained from the variable in the list. If you name the parameter I think it becomes blank if not given, and you loose access to <fieldname>

[Post script]
One area I am not sure of yet is if I want to paramatise a suffix to an operator eg in format:titlelist[] the titlelist, it can still be done with the \define` and a substitution. PPS Eric gave the answer here Can the suffix of an operator be given a variable? substitution in the backtick attributes.

PPPS;
Typicaly function returns only the first non-blank value (like cascades) but they can also be used to store lists or concatenate values with +[format:titlelist[join[ ]] OR +[join[ ]]