I have a need to read all the tiddler names from $:/HistoryList
in 5.2.3. Unfortunately it appears there are no filter operators available to work with JSON files, so my current solution is this rather verbose filter using regular expressions:
[
[$:/HistoryList]
get[text]
search-replace:g:regexp[\n|\r],[ ]
search-replace:g:regexp[.+?"title":\s*"(.+?)"],[$1~~]
split[~~]
limit[-1]
is[tiddler]
unique[]
]
While it works it has a few problems:
- It’ll break if there is a tiddler with
~~
in its name - It’ll break if there is a tiddler with a quote character in its name (This I can fix by encoding those escapes and decoding them later, but it has the same vulnerability)
- It’ll break if there is a tiddler with any other character that is escaped in JSON – to some extent I can handle that but only to some extent
I recall that the next version of TW will give some facilities to improve interfacing with JSON but I am interested in making it work in 5.2.3 or even 5.2.2. I could also just write a custom filter but it’s something that’ll ultimately land in a plugin so I am not sure that’s the direction I want to go just yet.