Hello Mat,
I think what you want ---generate links using a particular format for
each link, depending on some features of the target of the link---can be
achieved via macros, which give you the space to automate those checks
and generate the links according to their properties; you would have to
write those links like <<sl someTiddler>>, or <<sl "some other link">>,
but other than that I think it's serviceable.
If that sounds reasonable to you, check the macro definition below,
which formats links differently depending on whether they have either
the "bold" or the "italics" tag; I think it would be a good starting
point for you to introduce the templates you want to select
conditionally:
%%%%%%%%%%%%%%%%%%%%%%%%%% BEGIN TIDDLER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\define sl(target)
<$list filter="[[$target$]tag[bold]]">
<$link to="$target$"><b>{{$target$!!title}}</b></$link>
</$list>
<$list filter="[[$target$]tag[italics]]">
<$link to="$target$"><i>{{$target$!!title}}</i></$link>
</$list>
<$list filter="[[$target$]!tag[italics]!tag[bold]]">
<$link to="$target$">{{$target$!!title}}</$link>
</$list>
\end
%%%%%%%%%%%%%%%%%%%%%%%%%%% END TIDDLER %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
On Wed, Mar 24, 2021 at 04:33:14AM -0700, Mat wrote:
> Fellow cj suggests <
https://groups.google.com/g/tiddlywiki/c/Vt3CSHxnuc0> that
> we should be able to use transclusions with templates to represent special
> links. That is a very interesting idea because it would mean you can create
> a link with custom functionality and custom appearance using short syntax
> like {{this||template}}
>
> Now, that still requires an *explicit *template argument. I hope we could
> also create a *default *template (so it doesn't even have to be stated)
> that tests things conditionally. E.g {{argument}} tiddler is tagged Foo
> then the transclusion shows something whereas if it is tagged Bar then it
> shows something else.
>
> So, for the default transclusion, i.e what instructs to "show the text
> field", is there a *template* tiddler somewhere? Or is this hard coded,
> perhaps in:
>
> $:/core/modules/parsers/wikiparser/rules/filteredtranscludeblock.js
> <
https://tiddlywiki.com/prerelease/#%24%3A%2Fcore%2Fmodules%2Fparsers%2Fwikiparser%2Frules%2Ffilteredtranscludeblock.js>
>
> Actually...
>
> If this could somehow be achived direcly with [[bracket link]] syntax,
> that'd be even better. I.e you type [[links]] as always but there's a *template
> *to control how/what the rendered result is. Is a template involved in this
> that, so to say, makes it from [[this]] into *this* ?
>
> (E.g a full blown LinkWidget syntax is not practical in some cases, e.g
> during live note taking or when the typing must not disturb ones
> thoughts... which, btw, was the original purpose with wikitext, I believe)
>
> Thank you.
>
> <:-)
>
> --
> 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/d2c1d8d4-d67c-46ca-93d4-cef0af67645fn%40googlegroups.com.