I have for some time being looking for the method to insert another item (newTitle) into a tag list without actually tagging newTitle, and using the list-before or list-after fields.
For example the view template iterates all the items tagged $:/tags/ViewTemplate with this filter
[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]
Now perhaps with cascades you now have a custom view template and you want to include “newTitle” before $:/core/ui/ViewTemplate/body
?
- But you do not want to tag it with
$:/tags/ViewTemplate
because it will appear in other viewTemplates
[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]] +[insertbefore[newTitle],[$:/core/ui/ViewTemplate/body]]
So this is a filter version of using the list-before field, when newTitle is not tagged.
- Note this is only needed if you want to insert newTitle in the list generated by the tag, otherwise you could
There is another form
\define insert-before() $:/core/ui/ViewTemplate/body
Then use the following filter
[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]] +[insertbefore:insert-before[newTitle]]
I wonder why there is not insertafter Operator ? I imagine a clone and edit of $:/core/modules/filters/insertbefore.js
would achieve this quite easily.