Prepend string to field value in filter list - How?

46 views
Skip to first unread message

Matt Livingston

unread,
Apr 15, 2021, 10:07:52 AM4/15/21
to TiddlyWiki
Hi all,

I have a bunch of tiddlers named like "file name with spaces.pdf", matching a bunch of files in the Papers/ directory.
I want to set the _canonical_uri field equal to "Papers/file name with spaces.pdf"

Being a TW noob, I'm sure there's something I'm missing, but for the life of me I can't seem to prepend the "Papers/" part of the path onto the filename.  I can get the tiddler title into the field without the path, but whatever I do* to prepend "Papers/" winds up either not transcluding {{!!title}} or not prepending the path .

Here's what I have, which very nicely does only half of what I want what I want (uses the tiddler name)
---
<$list filter="[type[application/pdf]]">

<$button>
<$action-setfield $field="_canonical_uri" $value={{!!title}}/>
Update
</$button>
<$link/>

</$list>
---

I've tried:
      creating a <<concat str1 str2>> macro,
      using <$set name="thing" value="Papers/{{!!title}}"/>
      quoting the entire string
      not quoting anything
      quoting the path, but not the transcludifier

None of these worked.

Can someone help please?



Cheers,

Matt L.

Eric Shulman

unread,
Apr 15, 2021, 10:29:17 AM4/15/21
to TiddlyWiki
On Thursday, April 15, 2021 at 7:07:52 AM UTC-7 blub...@gmail.com wrote:
I have a bunch of tiddlers named like "file name with spaces.pdf", matching a bunch of files in the Papers/ directory.
I want to set the _canonical_uri field equal to "Papers/file name with spaces.pdf"
...I can't seem to prepend the "Papers/" part of the path onto the filename.
 
You can use an "inline filter" (aka, "filtered transclusion"), like this:
<$action-setfield _canonical_uri={{{ [<currentTiddler>addprefix[Papers/]] }}}/>

enjoy,
-e

Matt Livingston

unread,
Apr 15, 2021, 5:00:23 PM4/15/21
to TiddlyWiki
Thanks Eric.  That's exactly what I was looking for.

Reply all
Reply to author
Forward
0 new messages