Question about Refrences and Macros

74 views
Skip to first unread message

Huntsfromshadow

unread,
Sep 13, 2020, 4:15:30 PM9/13/20
to TiddlyWiki
Question about Reference List and Macros.

I have the following Setup.

1 - Tiddler 1 that has some random Text.
2 - Tiddler 2 that has [[Tiddler 1]] in it.

Tiddler 1 shows that Tiddler 2 refrences it (and thus isn't on the Orphan list).

If I replace the text in Tiddler 2 with
\define testme()
[[Tiddler 1]]
\end

<<testme>>

Tiddler 1 doesn't show any refrences to it (and thus is in the Orphan List).


Is this expected? Anyway to have the macro still report as a refrence?

Thanks
-Luke

Felicia Crow

unread,
Sep 13, 2020, 5:57:28 PM9/13/20
to TiddlyWiki
Hi,

yes this is absolutely expected behaviour and a problem that pops up in this group from time to time.

Tiddlywiki only recognizes hard links - everytime you use [[Link]] directly in the wikitext mostly - as references.
Everything else - links coming from macros, variables, transclusions, etc. - is a so called soft link and not recognized.

As for a solution: What would be your actual use case? There is no universial tiddlywiki recognizes soft links now solution, but maybe there can still be done something if it is clearer what you are trying to achieve.
Although one thing I can answer now is that from most approaches I have seen the item that would reference tiddler 1 would still be the tiddler you defined the macro in - so in your case tiddler 2 - not the macro itself.

Kind Regards,
Felicia.

huntsfromshadow

unread,
Sep 13, 2020, 7:40:18 PM9/13/20
to tiddl...@googlegroups.com
Honestly, in the great scheme of things, it isn't that big of a deal.

I was just curious if this was a known issue, or if I was just doing something wrong when I was returning the text back out of macros.

-Luke


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/5fba5ed1-17f1-41aa-9945-5c641b5a8b49o%40googlegroups.com.

TW Tones

unread,
Sep 13, 2020, 11:21:18 PM9/13/20
to TiddlyWiki
Luke,

As I understand it when a link is inside a define it becomes a macro and thus is not considered a link, the macro is "interpreted" then rendered and the result could be anything. I think this is why, perhaps by design, such links do not appear. Macros are also often defined elsewhere and tagged $:/tags/Macro, and perhaps you do not want those tiddlers listed.

However if you tag a tiddler containing the following with 

$:/tags/ViewTemplate

<$list filter="[all[current]list[text]]">

</$list>
You will see the reference is detected, only if the macro is actually used.

Of course we can also write a solution that searches all tiddlers and and finds in the string is in the text (including in a macro definition)
<$list filter="[all[tiddlers]contains:text[HelloThere]]">

</$list>
The advantage being it finds items with or without the Square braces, eg camel case
But may bring up other hits?

However if you use a carefully crafted a search you can always find all such links in or outside the define statements, after all all you want is to list tiddlers containing "[[searchvalue]]"

There are tricks available to concatenate a search string with characters that are illegal in filters or wikitext.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages