Tiddlername as tag

99 views
Skip to first unread message

Gerald Weis

unread,
Nov 25, 2020, 5:25:26 AM11/25/20
to TiddlyWiki
I have the following problem. In a tiddler I wrote the title exactly as I did in the tag. Now I would like to insert the title as a tag name in a macro. However,

´´´
<$ list [tag [<<CurrentTitle>>]] + [tag [$ art $]]>
```
does not work. at the moment my input looks like this.

```
<< person-device-a "tiddler name" "geraeteart" >>
```

Since there are several types of devices, the macro is called several times. The macro currently looks like this.

```
\ define person-device-a (person type)
<tr valign = middle align = left> <th> $ art $ </th>
<td>
<$ list filter = "[tag [$ art $] sort [title]] + [tag [$ person $] sort [title]]">
</td>
<td valign = middle align = center>
<$ list filter = "[tag [$ person $]] + [tag [$ art $] count []]"> </ $ list>
</td>
</tr>
\end
```

What I want is that I can save myself having to enter the tiddler name. Is there a way to do this?


Mark S.

unread,
Nov 25, 2020, 2:09:22 PM11/25/20
to TiddlyWiki
There was a lot of things going on in your code that I didn't understand. I assume that the current tiddler is the same as "person" ? You use "type" in the definition, but not in the code. And "art" in the code but not in the definition.

So I'm guessing you want something like the following. Note that you can reference a parameter as $art$ or as <<__art__>> in macro code. Inside a filter, a
variable could be referenced as tag[$art$] or as tag<__art__> .

Without a set of data, it's hard to test, but maybe this will help. Hopefully the new, wonderful GG editor doesn't insert spaces everywhere:

\define device-a(art)
<tr valign=middle align=left> <th>$art$</th>
<$list filter="[tag<__art__>sort[title]]+[tag<currentTiddler>sort[title]]">
<td valign=middle align=center>
<<currentTiddler>>
</td>
</$list>
<$list filter="[tag<__currentTiddler__>]+[tag[$art$]count[]]" >
<td><<currentTiddler>></td>
</$list>
</tr>
\end

<table margin="10">
<<device-a Stuff>>
</table>

soren.b...@gmail.com

unread,
Nov 25, 2020, 2:48:56 PM11/25/20
to TiddlyWiki
On Wednesday, November 25, 2020 at 1:09:22 PM UTC-6 Mark S. wrote:
Inside a filter, a variable could be referenced as tag[$art$] or as tag<__art__> .

Really? Did that work for you? I thought parameters-as-variables only work in a strict transclusion context with double angle brackets. In a simple test it yields a syntax error:

\define testme(parameter)
  <$list filter="[tag<__parameter__>]]">
  <$link to=<<currentTiddler>>/><br>
  </$list>
\end

<<testme Section>>

TW Tones

unread,
Nov 25, 2020, 6:02:22 PM11/25/20
to TiddlyWiki
I am not sure why you are using <__parameter__>?

it is more for cases like paramname=<__parameter__>

The following works;

\define testme(parameter)
  <$list filter="[tag[$parameter$]]" emptyMessage="nothing tagged $parameter$">
  <$link to=<<currentTiddler>>/><br>
  </$list>
\end

<<testme Section>>

Tones

Mark S.

unread,
Nov 25, 2020, 7:19:55 PM11/25/20
to TiddlyWiki
The angle braces REPLACE the square brackets in filter expressions. So your code should look like:

\define testme(parameter)
  <$list filter="[tag<__parameter__>]">
  <$link to=<<currentTiddler>>/><br>
  </$list>
\end



Gerald Weis

unread,
Nov 26, 2020, 6:05:58 AM11/26/20
to TiddlyWiki


I have a tiddly with which I manage the IT equipment of the staff.
There are also equipment tiddlers and personal tiddlers.
The names of the devices are stored as tags in the person tiddlers.
The names of the persons and the device classes are stored as tags in the device tiddlers.
Now I would like to determine from the person tiddler which devices the person has.
At the moment I have to enter the person name in the macro call, even though I have written the personal name exactly like the tag.
I want to avoid that.
My macro call currently looks like this:

<< person-device-a "person name" "device class" >>

The macro currently looks like this:

```
\ define person-device-a (person class)
<tr valign=middle align = left> <th>$class$</th>
<td><$list filter = "[tag [$class$]sort[title]]+[tag[$person$]sort [title]]"></td>
<td valign=middle align = center>
<$list filter="[tag[$person$]]+[tag [$class $]count[]]"></$list>
</td>
</tr>
\end
```

soren.b...@gmail.com

unread,
Nov 26, 2020, 9:39:22 AM11/26/20
to TiddlyWiki
My bad, that was a typo caused by my text editor’s bracket autocomplete. It
does work with the typo fixed, which is strange because I swear this has not
worked for me before. Maybe at the time I didn’t know anything about
TiddlyWiki and I was doing something else wrong. Learned something new,
thanks!

Tones, I would think the benefit is that the <__parameter__> syntax can’t get
messed up by quoting, no matter what is in the parameter (same reason you
might want to use it outside a filter). In your version, if there was a
double-quote in the name of the tag, the filter would break. You could use
triple quotes around the filter, but then triple quotes would mess it up, and
so on.

Gerald Weis

unread,
Nov 26, 2020, 11:25:25 AM11/26/20
to TiddlyWiki
Hello

What i wanna do is
1. Macro see what the user is called in the tiddler title.
2. Search which devices of the device class e.g. Screen the user has.
3. Show the devices in the user's tiddler.

Reply all
Reply to author
Forward
0 new messages