Hi
I’m creating “redirect” tiddler for fun. If the tiddler has a certain field, it will get the first line of the tiddler content (that is a link):
[[Redirect or Ref Link]]
I need to extract or find a way to place the link. I have tried (following endless AI examples), but I’m not getting there.
The end goal is very simple :
<$link to=<<link>>>
<$image source="https://site.xyz/image.jpg" />
</$link>
So now the issue:
1 - Get the tiddler first line = OK
2 - the <<link>>
#1 it’s in fact the tiddler link
3 - How do I place it ? Using <$link to=<<link>>
#1 it’s a literal [[link]]
4 - Convert it to a string ?
Don’ t know.
Tiddler content:
[[Redirect or Ref Link]]
<$let link={{{ [<currentTiddler>get[text]splitregexp[\n]first[]]
}}}>
* <<link>> (OK: link `http://192.168.1.8:4444/#Redirect%20or%20Ref%20Link`)
<$vars textlink=<<link>>>
* string: <$text text=<<textlink>>/> (it's a string)
<$let clean_string={{{ [<textlink>removeprefix<x>removesuffix<y>] }}} x="[[" y="]]">
* string: <$text text=<<clean_string>>/> `(Didn't remove the [[]])`
</$let>
<$link to=<<textlink>>>
<$image source="https://site.xyz/image.jpg" />
</$link>
* the ''textlink'' is now`http://192.168.1.8:4444/#[[Redirect%20or%20Ref%20Link]]`
</$vars>
</$let>
Any help would be great ! Thanks
[edited] #1 to make code visible by wrapping in backticks