The Format Operator

Ref: https://tiddlywiki.com/#format%20Operator

The format operator is very useful filter operator and I use it alot!
Why not to support numbers?

  • For example display numbers with leading zeros
  • Or with number of digits after decimal point
2 Likes

See https://github.com/Jermolene/TiddlyWiki5/issues/5073

Actually with the fact we can now use parameters in macros within filters and the possibilities of defining our own operators with “Parametrised transclusions” on the horizon this is only getting easier to do.

I see that I had shared a macro to do this on 24 Nov 2020

However a question that arrises is;

  • What if our macros used in a filter, could receive as a parameter the current value within the filter?.
    eg “[all[current]get[amount]<format-number p:3>]
    or if necessary [all[current]get[amount]pipe:n<format-number p:3>] format number with 3 places.
    where a new pipe operator names the parameter to use, in this case “n”
  • Basically this would be providing a “pipe” to allow a value to be piped into the macro, as it stands the output is passed back into the filter.

What do you think?

GitHub Discussion started #6890

1 Like