Request help: Transclude content of tags for the current tiddler

Hello all,

I would greatly appreciate some assistance creating the correct filter logic to transclude the tags (pointing to tiddlers) into the current tiddler. (I’m a long time basic Tiddlywiki user and a total neophyte tiddlywiki “programming”.)

Explanation: I have many tiddlers with tags like “Comp1”, “Comp2”, “Comp3” etc. as well as “Family”. I would like to transclude into the current tiddler only the content of the “CompX” tags excluding the “Family” tag or any other tags for that matter. I’d also like to create links in the tiddler to the “CompX” tiddlers to make changes easier.

After hours of searching and trial and lots of errors, this is what I have come up with.

 <$list filter="[all[current]tags[]] -[tag[Family]]">
  <h3> <$link to=<<currentTiddler>> > <$text text={{!!title}} /> </$link></h3>
  <$transclude tiddler={{!!title}} tags="{{!!tags}}" />
</$list>

Unfortunately, this does NOT exclude the “Family” tag.

I would greatly appreciate some help correcting the filter logic. A bit of explanation would also be appreciated.

Preston

Try…

[all[current]tags[]!match[Family]]
<$list filter="[<currentTiddler>tags[]prefix[Comp]]">
  <h3><$link/></h3>
  <$transclude/>
</$list>

Notes:

  • The $list filter gets all tags from the current tiddler, and then only includes those that start with “Comp”
  • Note that within the body of the $list widget, the current tiddler is set to each matching tag name
  • <$link/> is an abbreviated syntax that uses the current tiddler value as the link target (the to=... param) as well as the text to display. Thus, it is exactly equivalent to the more verbose <$link to=<<currentTiddler>>><$text text={{!!title}}/></$link> syntax you had used.
  • When the $transclude widget does not contain a tiddler=... param, it defaults to transcluding the current tiddler. Thus, <$transclude/> is exactly equivalent to <$transclude tiddler={{!!title}}/> or <$transclude tiddler=<<currentTiddler>>/>
  • In addition, the $transclude syntax doesn’t use a tags=... param. As a result, the parameter will be used to automatically define a variable named tags with a literal text value of “{{!!tags}}” that can be referenced within the contents of the transcluded tiddler.

enjoy,
-e

CodaCoder, EricShulman,

Thank you both for responding to my admittedly simpleton challenge. I’m not surprised both of you responded with guidance. You both give so much to the community… quite honestly, I got as far as I did based on previous guidance from you to other folks.

Eric, thank you for the extra effort to explain the functions and widgets; in other words teaching. I have found the TW syntax to be rather confusing with it’s an abundance of punctuation symbols. Your explanation of the “short hand” was perfect.

Sincerely,
Preston

1 Like

Hello @prestong!

Last cleanup step: if your request for help has been satisfied, please mark one of the responses as a solution. That way, it’s easier for folks to scan recent threads to see which questions remain unresolved.

Also, someone gets a nice digital blip of recognition. :slight_smile: