Hi,
now this is working for me:
\define rmprefix(tid,pref)
<$list filter="[[$tid$]] +[removeprefix[$pref$ ]]" emptyMessage="$tid$">
<$view field="title"/>
</$list>
\end
\define petLink(tid)
<$set name="prefix" filter="$tid$ +[first[]]">
<$link to="$tid$" class=<<prefix>>>
<$macrocall $name="rmprefix" tid="$tid$" pref=<<prefix>>/>
</$link>
</$set>
\end
<<petLink "Cat Mitzi">>
<<petLink "Dog Zerberus">>
Thanks,
Uwe
Am Donnerstag, 6. August 2015 11:00:23 UTC+2 schrieb UBi:
>
> Due to the given examples, I think I got the figure. Thanks to all!
>
> Meanwhile, I decided to use CSS to assign icons to the links. So my given
> example would change to
>
> \define getfirst(tid) <$list filter="$tid$ +[first[]]"><$view field=
> "title"/></$list>
> \define getrest(tid) <$list filter="$tid$ +[rest[]]"><$view field="title"
> /></$list>
> \define PetLink(first,rest) <$link to="$first$ $rest$" class="$first$">
> $rest$</$link>
> \define makePetLink(tid)
> <$macrocall $name="PetLink" first=<<getfirst "$tid$">> rest=<<getrest
> "$tid$">> />
> \end
>
> Start sample output
> <<getfirst "Dog Zerberus">>
> <<getrest "Dog Zerberus">>
> <<PetLink "Dog" "Zerberus">>
> <<makePetLink "Dog Zerberus">>
> End sample output
>
> all in one tiddler. The result:
>
> Start sample Output
>
> Dog
>
> Zerberus
>
> Zerberus
>
> <$link to="Dog Zerberus" class="Dog">Zerberus</$link>
>
> End sample output
>
> So the final question is the same as c pa's: How can I turn the last line
> in a working link?
>
> Thanks
> Uwe
>
>
> Am Mittwoch, 5. August 2015 21:22:24 UTC+2 schrieb c pa:
>>
>> Not sure why this doesn't work but it should (Instead this displays the
>> html rather than rendering it)
>>
>> \define getFirstWord(sentence)
>> <$list filter="$sentence$ +[first[]]"><$view field="title"/></$list>
>> \end
>> \define getLastWord(sentence)
>> <$list filter="$sentence$ +[last[]]"><$view field="title"/></$list>
>> \end
>> \define intermediate(what,who)
>> <$macrocall $name="PetLink" what="$what$" who="$who$" />
>> \end
>> \define makePetLink(tiddlerName)
>> <$macrocall $name="PetLink"
>> what=<<getFirstWord "$tiddlerName$">>
>> who=<<getLastWord "$tiddlerName$">>
>> />
>> \end
>> \define PetLink(what,who)
>> <$link to="$what$ $who$"><img
>> src="$what$.png"><span>$who$</span></$link>
>> \end
>>
>> <$macrocall $name="PetLink"
>> what=<<getFirstWord "dog sparky">>
>> who=<<getLastWord "dog sparky">>
>> />
>>
>> <$macrocall $name="makePetLink"
>> tiddlerName=<<currentTiddler>>
>> />
>>
>> <$macrocall $name="makePetLink"
>> tiddlerName="dog sparky"
>> />
>>
>> <<makePetLink "dog sparky">>
>>
>>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/aab6906d-c4bb-4b68-8d61-b851d656a3c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.