Hello good and wise people,
I found this lovely bit of code sat unused in one of my wikis. Whence it came from I do not know, It’s some code from @EricShulman, see his reply for an updated copy. though I think we can say with a high degree of confidence it is not my own! It creates a checkbox list of tags then lists tiddlers tagged with the checked boxes.
I post it here for two reasons.
- It’s quite useful and might be of use.
- I want to change it!
I would like to be able to take the results and output to one tiddler containing transclusions of the filtered results.
It kind of feels like I should know how to do this by now…
Anyway, here is the code; (thanks in advance).
\define maketagfilter() tag[$(currentTiddler)$]
<style>
.columns8 { display:block; -moz-column-count:8; -moz-column-gap:1em; -webkit-column-count:8; -webkit-column-gap:1em; font-size:60%; line-height:1em; }
.columns4 { display:block; -moz-column-count:4; -moz-column-gap:1em; -webkit-column-count:4; -webkit-column-gap:1em; font-size:80%; line-height:1.4em; }
</style>
__''SELECT TAGS:''__<br>
@@.columns8
<$list filter="[all[tiddlers+!shadows]tags[]sort[]]">
<$checkbox tiddler="selectedTags" index=<<currentTiddler>> checked=<<maketagfilter>>
checkactions="""<$action-setfield $tiddler="selectedTags" $index=<<currentTiddler>> $value=<<maketagfilter>> />"""
uncheckactions="""<$action-setfield $tiddler="selectedTags" $index=<<currentTiddler>> />""">
<$text text=<<currentTiddler>>/>
</$checkbox><br>
</$list>
@@
<$wikify name="filter" text="""[all[tiddlers+shadows]<$list filter="[title[selectedTags]indexes[]]">{{{ [[selectedTags]getindex<currentTiddler>] }}}</$list>]""">
__''RESULTS FOR FILTER: <$text text=<<filter>>/>''__<br>
<$reveal text=<<filter>> type="nomatch" default="[all[tiddlers+shadows]]">
@@.columns4 <$list filter=<<filter>>><$link/><br></$list>@@
</$reveal>
</$wikify>