Better Filter and Subfilter as Macro Input Parameters

I learned that a filter started with [ and ended with ]. But there are cases in Tiddlywiki where a subfilter like !tag[done] is asked to be passed. As an example see list-tagged-draggable. I know the reason (Wikitext limitation on filter syntax at the time of development such macros), but NOW Tiddlywiki allows much readable wikitext syntax.

These kind of odd rules makes learning TiddlyWiki quit hard. Passing a [!tag[done]] is more semantic and easier to learn, as it is like other filters and follow a general syntax.

My question is: Isn’t it the time to remove such odd rules?

1 Like

I understand the mechanisium that supports this is the subfilter operator and definatly should be used in new macros and solutions. If for now other reason than allowing them to be tested independantly before being passed as a parameter. Eg {{{ [tag[tagname]] }}}.

The issue seems to me backwards compatibility. Perhaps we can write a converter that tests for those outer [] and wrap it if not there, before using the parameter?

  • thus both forms will work on existing macros
  • changing the documentation so the new form gets used first

I suppose the first steps is identifying the cases and investigate if the above can be applied without too much complexity.

This is already considered to be deprecated. … But for compatibility reasons it is still there. We need to create a new macros with proper parameters and deprecate the old ones.

Time is the limiting factor here.

1 Like

Are you sure?

A Quick search on TiddlyWIki.com suggest the following macros are the only uses of this diminutive form of subfilter;

  • timeline Macro $:/core/macros/timeline
  • list-tagged-draggable Macro $:/core/macros/list
  • image-picker Macro $:/core/macros/image-picker

In all three cases the subfilter is an optional macro parameter

  • All we need to do is convert the subfilter parameter to a variable with the above format and replace the use of the substitution with the new variable.

So given a subfilter parameters of the form

  • tag[tagname] convert to [tag[taganame]] to set <<subfilter>>
  • [tag[taganame]] use as is to set <<subfilter>>
  • Update documentation to suggest the [tag[taganame]] form.
  • Rewrite the affected filters to use +[subfilter<subfilter>] or inline ...subfilter<subfilter>...

Now what is the best way to code the above?