I am not laughing @BurningTreeC and I am glad it works. I am impressed by its length
However I would be confident there is, or should be a MUCH better way.
Function names and prefixes
Also I have a different view to @pmario and prefer readable than prefixed names, but I do deploy a number of strategies to support this, although I will not detail it here.
- This difference of opinion is healthy in my view
- It is also heavily context dependant, such as is it only in a particular wiki, or something shared widely?
However lets simply refactor your solution;
\procedure tiddlyflex-filtered-story-list()
\function tf.search-tiddlers() [[list]addsuffix[<tv-story-list>]addsuffix[$(suffix)$]substitute[]addsuffix[ ]addsuffix[:filter]addsuffix[$(prefix)$]substitute[]addsuffix[{$:/config/tiddlyflex/story-river/filter}match]addsuffix[$(prefix)$]substitute[]addsuffix[yes]addsuffix[$(suffix)$]substitute[]addsuffix[then<currentTiddler>!is]addsuffix[$(prefix)$]substitute[]addsuffix[draft]addsuffix[$(suffix)$]substitute[]addsuffix[search:]] ${$(searchFields)$}$ +[substitute[]] +[join[]] +[addsuffix[:]] ${$(searchFlags)$}$ +[substitute[]] +[join[]] +[addsuffix[$(prefix)$]substitute[]addsuffix{$:/temp/search/input}addsuffix[$(suffix)$]substitute[]] +[addsuffix[else{$:/config/tiddlyflex/story-river/filter}!match]addsuffix[$(prefix)$]substitute[]addsuffix[yes]addsuffix[$(suffix)$]substitute[]addsuffix[then<currentTiddler>]] +[join[]] +[addprefix[$(prefix)$]substitute[]addsuffix[$(suffix)$]substitute[]] +[join[]]
<$vars prefix="[" suffix="]">
<$list filter=<<tf.search-tiddlers>> history=<<tv-history-list>> template="$:/core/ui/StoryTiddlerTemplate" storyview="tiddlyflex"/>
</$vars>
\end
By simply placing the “concatenation” function tf.search-tiddlers
inside the other you can use any name you want, as it is local to that function, even if the outer one is global.
- I am also tempted to split that functions definition across lines to make it more readable, but if we had a more general solution to this issue this would be less important.
The more general issue
As I see, it this issue you raised is a type that belongs to a class of problems, that I have tried to address in the past. As yet I dont have a satisfactory approach:
- using variables and transclusions as prefixes to filter operators.
- more generaly constructing filters using variables and transclusions that can then be displayed as text for documentation and/or also used as a filter.