Use several filters in a ViewTemplate tiddler to display tiddler raw content conditionally

56 views
Skip to first unread message

Mohammad

unread,
Jan 23, 2020, 4:46:08 AM1/23/20
to tiddl...@googlegroups.com
Objective

Tiddlywiki by default hides many scripts like macros. I would like to have a method to display tiddler raw content on demand 
 A simple form of this is already used in Utility plugin.
The methodology here is to use a ViewTemplate like below 

title: myTemplate
tag: $:/tags/ViewTemplate
text: as below

<$list filter="[all[current]tag[show-content]]">
<pre><$view/></pre>
</$list>


Now I like to let users to set their filters through a config tiddler.


Implementation
  • A tiddler called config/reveal-filters holds all filter like
    • [tag[show-content]] [tag[myTag]] [prefix[local/macro/]] [search:title[kookma]]
  • A view Template like below
<$set name=revealFilters tiddler="config/reveal-filters" field=text>
<$list filter="[all[current]]+[subfilter
<revealFilters>]" >
<pre><$view/></pre>
</$list>
</$set>

Unfortunately it does not work!

Question

 How can I implement a ViewTemplate to get a set of filters from user and display the raw content of tiddlers match those filters?


--Mohammad

Mohammad

unread,
Jan 23, 2020, 4:51:14 AM1/23/20
to tiddl...@googlegroups.com
For email readers: original post edited as below

subject: Use several filters in a ViewTemplate tiddler to display tiddler raw content conditionally

PMario

unread,
Jan 23, 2020, 7:17:52 AM1/23/20
to TiddlyWiki
Hi,

Just tested it and it works for me. .... Are you sure, you tagged your template with $:/tags/ViewTemplate ?? ... NO spaces in the tag?

-m

Mohammad

unread,
Jan 23, 2020, 8:12:42 AM1/23/20
to TiddlyWiki
Thanks Mario,
 It was a mistake on provided filters and now it works!

--Mohammad

Eskha

unread,
Jan 23, 2020, 8:31:05 AM1/23/20
to TiddlyWiki
Hi Mohammad,

What I use for a similar purpose is the following:

title: whateveryouwant
tag: $:/tags/ViewTemplate
text:

<$list filter="[all[current]tag[
show-content]]
[all[current]is[system]search:title[template]]
[all[current]tag[$:/tags/EditTemplate]]
[all[current]tag[$:/tags/ViewTemplate]]
[all[current]tag[$:/tags/Macro]]
+[limit[1]]">
<$codeblock code={{!!text}} language="xml" />
</$list>

Best regards,

Eskha


Mohammad

unread,
Jan 23, 2020, 8:47:10 AM1/23/20
to TiddlyWiki
Hi Eshka,
 Very smart solution!

Thank you! I will use it in my Utility plugin.

--Mohammad

Mohammad

unread,
Jan 23, 2020, 9:32:05 AM1/23/20
to TiddlyWiki
Added to TW-Scripts


On Thursday, January 23, 2020 at 5:01:05 PM UTC+3:30, Eskha wrote:
Reply all
Reply to author
Forward
0 new messages