My logic (but maybe/probably its wrong), tiddler “sauros” which is tagged “GrLat” appears as a transclude in the 'higher level tiddler “Brontosaurus” and “Anteosaurus”, but because the tag “GrLat” is more close to “sauros”, … “sauros” will/needs to appear in the “GrLat” section in Anki!?
I think if we walk through the process step by step, you’ll see why this doesn’t work.
- When TiddlyRemember syncs, it first scans through all of the tiddlers that match your syncing filter (in the Anki settings). If you haven’t changed this, it will look in, to a first approximation, all non-system tiddlers in your wiki.
- Now, for each of these tiddlers, TiddlyRemember actually renders the tiddler – the same process that’s used when you look at the tiddlers on the screen in TiddlyWiki. It doesn’t care about the tiddler’s wikitext, it only cares about what it looks like on the screen.
- After rendering the tiddler, it inspects the HTML to see what TiddlyRemember notes (Q/A and clozes) are in that rendered tiddler, and adds them to a big long flat list.
- Once it’s looked at all the tiddlers it’s going to, it takes the list of TiddlyRemember notes it’s made and compares it to your Anki collection, and adds, updates, and deletes notes as needed to bring your collection up to date.
In your case, you are ending up with multiple nearly identical entries in this big list for each cloze, because your clozes appear in multiple tiddlers. In your example above, the TiddlyRemember note created by the remembercz
call <<remembercz .... "{sauros}: {hagedis}">>
is entered into this list three times, and is in a different tiddler each time:
- Once in the tiddler
sauros
itself.
- A second time in
Brontosaurus
, because sauros
is transcluded into it.
- A third time in
Anteosaurus
, because sauros
is transcluded into it.
So what about your deck mapping? Well, the first time it appears in the list, your deck mapping specifies this cloze’s deck is _GrLat_
, because the cloze is part of the tiddler sauros
, which has the tag GrLat
. But the second time it appears, your deck mapping specifies its deck is intro
, because it’s part of the tiddler Brontosaurus
, which has the tag intro
. The third time, its deck is also intro
, because it’s part of the tiddler Anteosaurus
, which has the tag intro
.
Because transcluded text is indistinguishable to text that’s actually within the tiddler doing the transclusion once rendered (this is the whole point of transclusion, after all!), TiddlyRemember has no way of seeing which cloze is “closer to” the tag, as you say – as far as it is concerned, all three of the tiddlers this cloze appears in are equally “original” and valid. So the way you’ve set this up, the deck this cloze should go in is ambiguous – there’s no reason TiddlyRemember should pick one or the other in particular (except the intention you have in your head, which it obviously doesn’t know!).
But, maybe I understand, I don’t have to transclude “sauros” (the lower levels) into the “Brontosaurus” and “Anteosaurus” the higher levels. (Altough it looks nice), …???
If you want to continue using the exact layout you’re currently using, with the flexibility to transclude any tiddler that might contain any cloze that you don’t want to bring into the deck of the current tiddler anywhere, you need to find some way of transcluding the tiddlers containing TiddlyRemember notes only when TiddlyRemember is syncing and rendering these tiddlers. That way, each of your clozes will only be seen by TiddlyRemember once, in the original tiddler whose wikitext it’s physically located in.
In recent versions of TiddlyRemember, a variable called tr-rendering
gets set to yes
during syncs. So the simplest way to do this is:
<% if [<tr-rendering>!match[yes]] %>
{{brontē}}
{{sauros}}
<% endif %>
<<remembercz ...
"
{Brontosaurus}: {this means ...}
">>
That’s going to be awkward and error-prone to write all the time though, so I’d suggest wrapping this up in a template tiddler, which I’ll call RenderUnlessSyncing
(obviously you can call it whatever you want; in practice you might want something very short since you’ll be typing it a lot):
<% if [<tr-rendering>!match[yes]] %>
<$transclude/>
<% endif %>
Then you can write your tiddler as:
{{brontē||RenderUnlessSyncing}}
{{sauros||RenderUnlessSyncing}}
<<remembercz ...
"
{Brontosaurus}: {this means ...}
">>
…and everything will work as you want.
Because this is TiddlyWiki, I’m sure we could come up with 37 other solutions as well, some of which might be better…this is just the first one that popped into my head.