TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
8.09k stars 1.19k forks source link

[BUG] Map and the Value of the Variable currentTiddler Outside the Filter run in File System Paths #8520

Open kookma opened 3 months ago

kookma commented 3 months ago

Describe the bug

There is an interesting discussion on Talk: https://talk.tiddlywiki.org/t/file-system-path-store-tiddlers-come-from-a-tiddler-field/10419. The question is how to write a filter for $:/config/FileSystemPaths to store tiddlers listed in diary field of other tiddlers under diary/ sub folder.

The working filter is reported to be: (I tested and it works as said)

[has[title]] :filter[all[tiddlers]contains:diary<currentTiddler>] :and[addprefix[diary/]]

For curiosity, I changed the filter as below to add the tiddler lists the target tiddler in its diary field to the path. So, I used :map:

[has[title]listed[diary]] :map[get[title]addsuffix[/diary/]addsuffix<..currentTiddler>]

and I noticed the <..currentTiddler>. as tiddlers are stored as .tid with no title.

Expected behavior

The filter [has[title]listed[diary]] :map[get[title]addsuffix[/diary/]addsuffix<..currentTiddler>] in $:/config/FileSystemPaths should work.

The <..currentTiddler> should return the value of the variable currentTiddler outside the filter run.

TiddlyWiki Configuration

kookma commented 3 months ago

I have created a test set for quick evaluation. The pack contains below tiddlers

Test Path
$:/config/FileSystemPaths
One
Two
Thirty Four
16th August 2024

The test path contains a method by @saqimtiaz to check the validity of filters in $:/config/FileSystemPaths it works, but the file saved with no title. Seems something goes strange in FS and does not respect the <..currentTiddler>.

The 16th August 2024 has diary field with One Two [[Thirty Four]] as value.

test-set.zip

saqimtiaz commented 3 months ago

[has[title]listed[diary]] :map[get[title]addsuffix[/diary/]addsuffix<..currentTiddler>]

@kookma can you please confirm the exact file path at which the tiddler is stored with this filter? Does it respect the diary suffix?

saqimtiaz commented 3 months ago

The problem here is that there is no value of the variable currentTiddler in the filter expression of a file system path unless set by a filter run within it. See #8544

kookma commented 3 months ago

Thank you for clarification Saq. I am closely following the progress of issue #8544.