Show when tagged in tiddler content

197 views
Skip to first unread message

TonyM

unread,
Jun 26, 2012, 11:20:04 PM6/26/12
to tiddl...@googlegroups.com
Folks,

A feature I really want and surprises me it seems is not available.

I have tiddlers tagged "work" and "personal"

I would like to have part of a tiddler rendered if the tiddler is tagged work and another part if it is tagged personal. That is an equivalent to the ShowwhenTagged and HidewhenTagged within a tiddler not in the view templates but in the content.

Thanks in Advance !
TonyM


 

Eric Shulman

unread,
Jun 27, 2012, 12:02:47 AM6/27/12
to TiddlyWiki
> I have tiddlers tagged "work" and "personal"
>
> I would like to have part of a tiddler rendered if the tiddler is tagged
> work and another part if it is tagged personal.

Add the following CSS to your StyleSheet:
.work { display:none; }
div[tags~="work"].tiddler .work { display:inline; }
.personal { display:none; }
div[tags~="personal"].tiddler .personal { display:inline; }
Next, in your tiddler content, write something like this:
{{work{this is work content}}}
{{personal{this is personal content}}}
and tag the tiddler with either "work" or "personal" (or neither or
both!). By default, the CSS-wrapped content is hidden, and will only
be displayed if the tiddler is tagged with the corresponding tag
value. QED.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

WAS THIS ANSWER HELPFUL? IF SO, PLEASE MAKE A DONATION
http://www.TiddlyTools.com/#Donations
Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact

TonyM

unread,
Jun 27, 2012, 2:31:53 AM6/27/12
to tiddl...@googlegroups.com
Thanks Eric,

I will do this right away - however the full truth is I have tiddlers tagged ":work" and ":personal" is this leading ":" goingf to trip this up ?, any workaround or should I globally rename my tags and tiddlers with them named in it to be sans ":" ?

Thanks Very much

TonyM

unread,
Jun 27, 2012, 2:35:17 AM6/27/12
to tiddl...@googlegroups.com
Ahh I see just change ... s~=":personal"] ...

+1 for a donation to Eric, I have done so and I encourage you all to do So.

HansWobbe

unread,
Jun 30, 2012, 1:31:40 PM6/30/12
to tiddl...@googlegroups.com
A really neat and useful method that hadn't occurred to me, before this.  Thanks for sharing!

Julio

unread,
Jun 30, 2012, 3:58:50 PM6/30/12
to tiddl...@googlegroups.com
Hello Eric and all,

I tried to play around with this and follow on.
I created a tiddler [[tagInTiddler1]] and then in my css tiddler [[jpen24_Css]] I put in your css code.

For some odd reason the "work" portion will not stay hidden when not tagged.
The ''personal'' portion is hidden fine though.

Did I do something wrong or am I overlooking something?
Below I will throw in a minimal test case to show you.


Best regards,

Julio


On Wednesday, June 27, 2012 12:02:47 AM UTC-4, Eric Shulman wrote:

Eric Shulman

unread,
Jun 30, 2012, 5:30:08 PM6/30/12
to TiddlyWiki
> I tried to play around with this and follow on.
> I created a tiddler [[tagInTiddler1]] and then in my
> css tiddler [[jpen24_Css]] I put in your css code.
> For some odd reason the "work" portion will not stay hidden when not tagged.
> The ''personal'' portion is hidden fine though.
> Did I do something wrong or am I overlooking something?

The problem is due to the notation you pasted into your CSS,
immediately preceding the definitions for .work and .personal CSS
classes. You need to make sure that non-CSS content is properly
enclosed in CSS comment markers (i.e., /* and */). In addition, to
allow wiki-formatted content within the note, you can use the TW
'wikified comment' syntax (/*** and ***/, each on it's own line), like
this:

/***
''Reference:'' https://groups.google.com/forum/?fromgroups#!topic/tiddlywiki/SEIPnAVxRA0
↓
***/

With the stylesheet content properly commented, it no longer
interferes with the CSS definitions that follow it, and the selective
display of tiddler content within the CSS wrappers then works as
intended.

Julio

unread,
Jul 1, 2012, 12:14:15 AM7/1/12
to tiddl...@googlegroups.com
Hello Eric,

That works...thanks a million!
I definitely knew something was amiss.

PMario

unread,
Jul 1, 2012, 11:29:51 AM7/1/12
to TiddlyWiki
I did think about a way to use the hideWhen stuff inside tiddler text.
IMO it's ugly but it should work.

see: http://groups.google.com/group/tiddlywiki/browse_thread/thread/7327cb04b61d47f4

have fun!
mario

Reply all
Reply to author
Forward
0 new messages