And if then for knowing if tiddler has an specific tag or not

78 views
Skip to first unread message

somen...@gmail.com

unread,
Jun 13, 2016, 4:44:07 AM6/13/16
to TiddlyWiki
Hi,

I have this:

<ol>
<$list filter="[!has[draft.of]tag[3-act]sort[title]]">
<li><$link to={{!!title}}><$view field="title"/></$link><if [has[description]]> <em><$view field="abstract"/></em></if></li>

</$list>
</ol>

it works perfect. But I want to display in red the tiddlers with tag[feina] and !tag[completada]. How can I do that? <if [tag[feina]!tag[completada]]>...</if> causes no efect. The same with has[feina]...

Any hints?

Thanks,


somen...@gmail.com

unread,
Jun 13, 2016, 4:50:14 AM6/13/16
to TiddlyWiki
I use TW5

Jed Carty

unread,
Jun 13, 2016, 7:29:34 AM6/13/16
to TiddlyWiki
Using the emptyMessage attribute of the list widget you can make simple if statements. Like this:


<ol>
<$list filter="[!has[draft.of]tag[3-act]sort[title]]">
<$list filter='[is[current]tag[feina]][is[current]!tag[completada]]' emptyMessage='<li><$link to={{!!title}}><$view field="title"/></$link><$list filter='is[current]has[abstract]'> <em><$view field="abstract"/></em></$list></li>'>
<li style='color:red'><$link to={{!!title}}><$view field="title"/></$link><$list filter='is[current]has[abstract]'> <em><$view field="abstract"/></em></$list></li>
</$list>
</$list>
</ol>

with the inner list widget if the current list item has the tag feina or doesn't have the tag completada than the contents of emptyMessage is shown, otherwise the one with the color is shown.
There are other ways to do this using either the set or the reveal widgets also, but I think this is the simplest one.

Xavier

unread,
Jun 13, 2016, 12:30:22 PM6/13/16
to tiddl...@googlegroups.com
Thanks. So `if` and `then` tags are not recommended.

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/f6IUb0e61AM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e3c66d42-cce6-4269-9ecb-f3f30db9f36f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages