How to autogenerate links

91 views
Skip to first unread message

Tristan

unread,
Aug 21, 2019, 5:12:35 AM8/21/19
to TiddlyWiki
Hey guys,

I am pretty sure this question was asked before but finding stull in GoogleGroups is some arcane witchcraft I am not capable of...

I have a tiddler with a field "filetypes" containing a list of filetypes: "pdf jpg png"

I need to generate multiple external links for every filetype like this: "[ext[/some/path/file.pdf|jpg|png]]"

What I tried was using a list widget but that generates gibberish:

<$vars bookid=<<currentTiddler>>>
    <$list filter="[list[!!filetypes]]">
        [ext[/book/{bookid}/book.
<currentTiddler>]]
    </$list>
</$vars>

My second guess was using a wikify widget but that did not work either. I am pretty sure there is a straightforward and easy answer to this and my overengineering mind plays me here.

Any help would be very much appreciated, thanks in advance,
Tristan

Jed Carty

unread,
Aug 21, 2019, 7:41:45 AM8/21/19
to TiddlyWiki

Tristan

unread,
Aug 21, 2019, 9:51:17 AM8/21/19
to TiddlyWiki
Thanks Jed,

so I figure there is no "build in" in TW way to concatenate text and values as of now? I would have thought that this is a relatively basic use case.

Cheers,
Tristan

On Wednesday, August 21, 2019 at 11:41:45 AM UTC, Jed Carty wrote:

Jed Carty

unread,
Aug 21, 2019, 1:38:48 PM8/21/19
to TiddlyWiki
You can probably do what you are trying to do using the add suffix filter operator as well.

Mark S.

unread,
Aug 21, 2019, 5:36:39 PM8/21/19
to TiddlyWiki
I was hoping to do this with the link widget, but there doesn't seem to be any way to force it to see the link as external.
But rolling your own links with the <a> anchor seems to work:

<$vars bookid=<<currentTiddler>> >

    <$list filter="[list[!!filetypes]]">
          <a href={{{ [title
<bookid>addsuffix[/book.]addsuffix<currentTiddler>addprefix[/book/]] }}} > <$text text={{{ [title<bookid>addsuffix[/book.]addsuffix<currentTiddler>addprefix[/book/]] }}}/></a><br/>
       
    </$list>
</$vars>


Tristan

unread,
Aug 22, 2019, 11:01:19 AM8/22/19
to TiddlyWiki
Thank you, that worked! :)
Reply all
Reply to author
Forward
0 new messages