\define tagging()
<$list filter="[all[current]tagging[]]">
</$list>
\endOr are you suggesting I should use a transclusion template rather than an actual macro?
\define tagging()
<$list filter="[all[current]tagging[]]"/>
\end
The content of the<$list>widget is an optional template to use for rendering each tiddler in the list. Alternatively, the template can be specified as a tiddler title in thetemplateattribute. As a fallback, the default template just displays the tiddler title.
I was trying to create a simple tagging macro tagged $:/tags/Macro , so I thought.http://taggly5.tiddlyspot.com/#%24%3A%2Fmacros%2Ftagging\define tagging() <$list filter="[all[current]tagging[]]"> </$list> \endAny reason why it won't run at all?
Because you defined your macro tiddler to be plain/text type, so it is not interpreted.
\define tagging(title:"<<currentTiddler>>")
<$set name="myTitle" value=$title$>
<<myTitle>>
<$list filter="[title<myTitle>tagging[]]">
</$list>
</$set>
\end
All content for current tiddler...
<<tagging>>
All content for Class B...
<<tagging "'Class B'">>
However for it to work with a title, you need to use a trick:
All content for Class B...
<<tagging "'Class B'">>
The parameter with the title of the tiddler also contains ticks, so that the value of the set widget is interpreted correctly (it should be value=<<currentTiddler>> in one case and value="title" in the second, so the $title$ substitution can't do both at the same time).
\define tagging(title, type:ul)
<$type$>
<$list filter="""[[$title$]tagging[]]"""><li><$link><<currentTiddler>></$link></li></$list>
</$type$>
\end
<<tagging "a b">>
tag a tiddler with: a"b ... and try your macro with
<<tagging 'a"b'>>You may want to try this for tags with spaces
<<tagging>>Yes, I thought about this. ... but the tiddler where you don't have a parameter is the tag.
You can use <<list-links filter:"[all[current]tagging[]]">>
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.
\define tagging(title)
<$set name="tid" value=$title$ default="<<currentTiddler>>">
<$list filter="[[<<tid>>]tagging[]]"/>
\end
I was wondering how difficult it might be to extend the set widget so as to allow a default value as a fallback for when the value is actually undefined:
\define tagging(title)
<$set name="tid" value=$title$ default="<<currentTiddler>>">
<$list filter="[[<<tid>>]tagging[]]"/>
\end
\define tagging(title)
<$set name="tid" value=$title$ default="<<currentTiddler>>">
<$list filter="[[<<tid>>]tagging[]]"/>
\end
I am not sure if that would help or be the correct syntax, the latter mostly thanks to me not quite being able to decipher the documentation for variables on tiddlywiki.com.Best wishes, Tobias.
Bear in mind that macro parameters are processed with text substitution, so passing "Hello There" as a title gives you value=Hello There, which won't work as expected. The fix is to use quotes; triple quotes are recommended because that allows titles to contain single or double quotes.
This example wouldn't work for a title containing spaces.
\define tagging(title)
<$set name="tid" value="""$title$""" default="<<currentTiddler>>"/>
<$list filter="[[<<tid>>]tagging[]]"/>
\endThe trouble is that in many situations an empty string is a valid value that shouldn't be defaulted; what we really want here is a way to detect missing parameters.
Ok, so let's consider the hypothetical syntax fixed...\define tagging(title)
<$set name="tid" value="""$title$""" default="<<currentTiddler>>"/>
<$list filter="[[<<tid>>]tagging[]]"/>
\endThe trouble is that in many situations an empty string is a valid value that shouldn't be defaulted; what we really want here is a way to detect missing parameters.How and when are variables evaluated? Could the evaluation return some <<undefined>> or <<null>> value subsequently passed to the set widget in order to trigger using a default fallback?
Best wishes, Tobias.
<$set name="tid" value="""""" default="<<currentTiddler>>"/>So, there's an empty string being passed as the attribute "value". There's no way for the set widget to distinguish that empty string as a missing value that needs to be defaulted unless it regarded all empty strings as missing values. The trouble with that is that often we want to be able to assign an empty string to a variable. That could be accomplished by assigning the empty string as expected if the "default" attribute is missing.
<$set name="tid" value="""<<undefined>>""" default="<<currentTiddler>>"/>