How to transclude/extract a part of a tiddler into a popup or a modal?

Hi everyone,
Thomas Elmiger created the Extract Macro that allows you to transclude a segment of a tiddler into another tiddler. I wonder if it would be possible to show/transclude/extract that segment directly into a popup or a modal ?
Thanks

Hi pedruchini,
Nice to see that people in 2022 still find and use stuff I made years ago.
Maybe you should tell us more details about what exactly you would like to do, what you have tried and where you got stuck. Context makes it easier for others to help.
All the best,
Thomas

Sure! Whatever you have for displaying popups or modals should work with this, as long as you’re not using <<>> to invoke your popup or modal.

Someone else may have a more elegant answer or solution. But here’s my walkthrough: Suppose you use Dave Gifford’s tooltip-based popups, here (which I do):
https://giffmex.org/gifts/transclusioninpopups.html

It’s designed for transcluding previews of external links, but it works just fine if you replace the tooltip content with a filtered extraction, like so:

<div class="tooltip">HOVER HERE
<div class="tooltiptext">
<$list filter="[!is[system]!<currentTiddler>]">
<<extract start:"TiddlyWi" end:"i" limit:"yes" rmQuotes:"yes">>
</$list>
</div>
</div>

If you hover over “HOVER HERE” the popup should show a k for every time the text TiddlyWiki appears in any other non-system tiddler.

-Springer

Hi Thomas,
It’s nice to see you again. It was a time when you were more active on these forums.
Yes, your macros are very useful for coding ignorants like me. I also use TextStrech.

I’m using tiddlywiki to teach french and this is what I want to achieve:

Let’s suppose that in Tiddler A there is an explanation about partitive articles in french. It could be something like this
The most important part of this explanation is the first table, where you can see the french partitives.

Now, at the beginning of tiddler B, before starting an explanation about another subject related to partitive articles, I want to remind my students which are the partitive articles, but I only want to “pop up” the aforementioned table, I don’t want to “pop up” the whole explanation.

And I will probably need to show that table again, for example in the middle of tiddler H or at the end of tiddler Q.

Obviously, I can imagine other solutions: to put that table on a separate tiddler (or in an field) an use transclusion, but that means too many tiddlers and it’s a bit more “cumbersome”.

Hi, Springer,
Your solution helped me a lot. That’s what I did and it works:

<div class="tooltip">HOVER HERE
<div class="tooltiptext">
<<extract "TIDDLERNAME" start:"<!-- x -->" end:"<!-- /x -->">>
</div>
</div>

As you said, maybe someone may have a more elegant solution.

And, what about a modal instead of a tooltip ? Is that possible ?

All the best,
Pedro

Thanks very much for this example and link pedruchini, it has pointed me in the direction of Thomas’s very nice ‘extract macro’ which I tried out on a TW popup site I’m experimenting with here and it does work with modals. There are some popup resources links there too if they happen to be useful for you.

Thank you Springer as well for the reminder about David Gifford’s excellent giffmex site!

I didn’t install ‘extract’ permanently as I wanted to ask Thomas’s permission first.

@telmiger would you mind if I included the macro for use on that page? Nearly everything else on it has been shamelessly lifted from the forums and badly mangled by me but your macro just works so it should stand out.

Hi folks

@pedruchini Thank you for the explanations. When I chose TW some time ago, it was the philosophy of tiny re-usable pieces that attracted me most. So I would have opted for table tiddlers and transclusions for your project. But I am not you and another main attraction of TW is that everyone can write and build as she or he likes best.

@Watt of course you can include my macros everywhere you like. In this case the DWYWBDBM-Licence might apply. The acronym was invented by myself and means: Do what you want, but don’t blame me ;–)

I am still reading here from time to time, but mentions help of course to get my attention. I am enjoying the activity around TW really much, but I do not have time to invest in further TW development as I have other projects that need my attention.

All the best,
Thomas

1 Like

Thank you very much Thomas, Happy 2022!

1 Like

@Watt, thank you for your popup resources. I will take a look at those links.

@telmiger, «viel GlĂŒck» with your projects !

1 Like

Here’s an example using extract with a modal launched from a button. You can make the button look like a link if you prefer. A display tiddler is used to display the extracted information. The display tiddler gets the name of the tiddler to use from the “extractee” variable, which is set in the action-sendmessage widget from the launching tiddler.

extract-with-modal.json (777 Bytes)

1 Like

It works like a charm.

I marvel at the things we can do with Tiddlywiki.

Thank you very much, @Mark_S.

All the best,
Pedro