I was trying out lightbox prototype created by Charlie Veniot as mentioned in this post.
In an example, he was using a filtered transclusion to show images in lightbox.
I have a tiddler with multiple images of this format [img[xxxxxxx.jpg]]. I want to extract these images using regexp and show them in the lightbox setup as shown in the frist example. Does anyone know how to create such a filter using regexp ?
This what I could find from google search, but these deals with markdown images
Starter kit. More complicated than your original because it needs to remove spaces from the expression and provide special variables for certain constructions.
However, this probably isnât the way you were thinking of invoking it (applying inside of current tiddler) since the current tiddler would already have the images.
Itâs coming from the image links. So obviously the filter needs to be tweaked. Iâm just amazed though â I thought Charles macro would only work with image tiddlers â not image references.
This one works, but I am not yet sure how I want to implement it. Will have to check other lightbox solutions in TW and choose one which suits my approach. I will revisit this thread at a later date. Thank you @Mark_S for all your help.
I am not familiar with Markâs code but I do spot a lot of syntax errors. I highly recommend taking the time to familiarize yourself with basic wikitext syntax.
This version below corrects the syntax issues that I spotted at a quick glance:
@Mark_S
I had used a lightbox macro by Telumire in the past.
So some of the images in my tiddlers have this format <<lightbox 'url'>>
And some of them are within details widget.
Is it possible to extract such images using regexp?
This is a sample tiddler
Edit:
Also images like in this tiddler are not getting extracted.
Possible ⌠probably. Easy ⌠not so much. But I think thatâs the approach Mohammad uses in refnotes to extract references. But in that case, we ended up using a JS macro I wrote. Sadly, TW still lacks the tools you need to easily extract patterns. It has bits and pieces that kind of approach one end or the other end of the problem, but doesnât give you a one-stop solution. So you end up with long, complicated filter runs.
The current extractor only extracts images with the jpg extension. It would need some more work for other file extensions.
If youâre serious about extracting images, and donât mind using 3rd party tools, then adding the regexps tool from this sad little PR might simplify things:
I have custom filters and macros that would probably handle this use case quite well. You are looking at a 2-3 week period before I can get them published though.
As you mentioned in this post, I tried the code to extract the lightbox images and created a button to show it in spotlight. But it doesnt seem to work. Click on the lightbulb button in the subtitle of this tiddler
This version seems to deploy the lightboxes. The alternative would be to do a second stage regexp after the first that extracts everything in the string, and then feed that string to lightbox launched by a $macrocall widget.
This seems to work. How will I incorporate it into this button
More that the lightbox images, these images form a major bulk in my wiki. I am gradually reducing the use of lightbox and trying to shift to spotlight. Is there any way to extract them?