Replies: 5 comments 7 replies
-
I am not sure what you want to show with your testcases. There is the function-operator, which allows us to call functions in filter-runs
If you want to call a function with inputs, you have to give it input parameters
Calling functions without the
But that's probably not what you want to show us. |
Beta Was this translation helpful? Give feedback.
-
Thanks @btheado, very intriguing. I would also think that I did create a simple test case:
|
Beta Was this translation helpful? Give feedback.
-
Here is my analysis of the code. I don' t have a good big picture understanding of The TiddlyWiki5/core/modules/filters/function.js Lines 24 to 26 in 028c807
TiddlyWiki5/core/modules/widgets/widget.js Line 164 in 028c807 Each filter run always starts with empty TiddlyWiki5/core/modules/filters.js Lines 344 to 349 in 028c807 The TiddlyWiki5/core/modules/filterrunprefixes/all.js Lines 19 to 22 in 028c807 However, the TiddlyWiki5/core/modules/filterrunprefixes/map.js Lines 15 to 19 in 028c807 The TiddlyWiki5/core/modules/filterrunprefixes/and.js Lines 19 to 24 in 028c807 Edit: Link to the correct filter run results initialization |
Beta Was this translation helpful? Give feedback.
-
Linking to a discussion about the same issue: https://talk.tiddlywiki.org/t/wikitext-code-editor/11211 |
Beta Was this translation helpful? Give feedback.
-
I found this code which seems to be a workaround that is somewhat related: TiddlyWiki5/core/modules/widgets/action-listops.js Lines 72 to 76 in 1f34c62 It was introduced in #6540. @Jermolene, it looks like you added Maybe you already knew |
Beta Was this translation helpful? Give feedback.
-
Based on experiments, I find that functions must begin with
:or
(or blank), or:all
(or=
) prefix in order to receive input. Given that constraint, functions which need to process input should using one of the other filter run prefixes should start always start with[all[]]
, or:or[all[]]
, or:all[all[]]
, or=[all[]]
. Theall
operator serves as an identity/no-op/passthrough operator. There are other operators which can act as passthrough (i.e.[prefix[]]
with no argument), but[all[]]
might be the most clear.I did not find any mention of this requirement in the docs, so I plan to add it. But one thing I don't know is the reason for it. Does it have to be this way? I could just document the requirement as a fact, but it would be nice to include an explanation. Can anyone help with the explanation?
Here is a passing test case which shows any named prefix can receive input as long as it starts with
[all[]]
Here is a test case which shows without the
[all[]]
, most of the prefixes don't receive inputI wrote similar test cases for the subfilter operator and the behavior is consistent.
Check out a live version at the share site
Edit: Added explicit call to the
title
operator to hopefully make it a little more clear.Beta Was this translation helpful? Give feedback.
All reactions