How to extract plugin content

Hello everyone.

I’m testing different plugins to get things I need for my system, and I’d like to know if there’s a way to extract individual tiddlers from a plugin.
I’ve tried using Tinka and Gatha, but nothing has worked. In Gatha, there’s an option to download the plugins to a folder for use in Node, but it doesn’t work for me. Maybe it’s because Gatha needs to be installed on Node, but right now I’m using Tiddlywiki in a single file.
Do you know of a way to extract them, or at least open them all at once, in Tiddlywiki other than opening them one by one and saving them?

Thanks.

You can list them all in the $:/AdvancedSearch > Filter tab, using the plugintiddlers operator. That tab also has an export button that lets you get them all as JSON. You could use this, and then choose the ones you actually want on an import to another wiki.

For instance, to see the tiddlers in the confetti plugin, enter this in the input box in that tab:

[[$:/plugins/tiddlywiki/confetti]plugintiddlers[]]

It wouldn’t be hard to write a small UI that lets you choose them before export. But it’s probably not worth it unless you have to do a lot of these.

1 Like

Hi Scott.

Thanks for the search pattern, I didn’t know it could be done that way.
The thing is, what I want is to export them as individual files, and I can’t think of how, except to do it one at a time.

I know with a Node installation, you could do it by importing the file with all the tiddlers, but I don’t currently have Tiddlywiki on Node.
I’ve tried @Mohammad’s Commander, but it also exports them in bulk.

Give this a try: TiddlyTools/Search/Filters

  • Import the above tiddler (drag-and-drop the tiddler title) into your TiddlyWiki
  • Enter your search filter (the same as you would in the $:/AdvancedSearch > Filter tab)
  • When the list of tiddlers is shown, click the “export” button (upper-right, above the filter input)
  • A modal dialog is shown:
    • You can set/clear individual checkboxes to “trim” the list of tiddlers you want to export
    • Select the “[x] one tiddler per file” checkbox (in the center of the footer)
    • Press the “export” button (lower-right corner)

If you’ve set your browser to “always ask where to save downloads”, you will prompted separately to save each .json file.

enjoy,
-e

3 Likes

Hi @JuanPalomo
Both Eric and Scott have shared solutions. The TiddlyTools/Search/Filters is very powerful and seems like a great choice.

As for the Commander, it allows for selective operations. After filtering all tiddlers in a plugin, you can pick the ones you prefer and export them.

1 Like

Thank you very much, Scott and Eric.

With Scott’s filter [[plugin name]plugintiddlers[]], I was able to extract the tiddlers I wanted, and with Eric’s app [all[tiddlers]prefix[plugin name]], I was able to export them individually as needed.

Best regards

Just note that prefixing your plugin tiddler titles with the plugin name is a strong convention, but not a strict requirement. Sometimes, you need to use another namespace. So you might want to use plugintiddlers in Eric’s tool as well, with a filter like:

[[$:/plugins/tiddlywiki/geospatial]plugintiddlers[]]
2 Likes

I typically drag and drop the link from Control Panel>Plugins>Contents Tab of the Plugin I am interested in if I am looking for specific tiddler.

Am I potentially missing tiddlers associated with a given plugin with this method?

Hi John.

I understand that what you’re doing is fine. If you simply want a tiddler, or a couple of them, and you drag them onto another Tiddlywiki, you won’t leave anything behind. Unless, of course, that tiddler is related to others that you don’t import, and therefore it won’t work properly.
In my case, since I needed to download them all individually, that solution wasn’t suitable, since it would require a considerable amount of time, depending on the number of tiddlers I was processing. But thanks to the instructions from @Scott_Sauyet and @EricShulman, it’s done in a few seconds.

Best regards.

I did write such a UI during a slow meeting yesterday. I don’t think it meets the needs of the OP. But instead of throwing it away, I thought I’d post it before I close the tab where I developed it.

It lets you choose an installed plugin, select any or all of the tiddlers it includes, and drag them to another wiki. But it doesn’t do a download, which should be easy enough. And if it did, there would still be work to do to the separate file downloads, and Eric already has that covered.


This is the entire code:

!!! Plugin: 

<$select tiddler="$:/temp/plugin-extractor" field="plugin" actions='<$action-setfield $tiddler="$:/temp/plugin-extractor" $field="tiddlers" $value={{{ [{$:/temp/plugin-extractor!!plugin}plugintiddlers[]format:titlelist[]join[ ]] }}} />'>
  <option value="">--please choose--</option>
  <$list filter="[all[tiddlers+shadows]plugin-type[plugin]]">
    <option><<currentTiddler>></option>
  </$list>
</$select>

<% if [{$:/temp/plugin-extractor!!plugin}!match[]] %>

----------
!!! Tiddlers

<$checkbox  tiddler="$:/temp/plugin-extractor" field="tiddlers" checked={{{ [{$:/temp/plugin-extractor!!plugin}plugintiddlers[]format:titlelist[]join[ ]] }}} unchecked=""/> All<br/><br/>

<$list filter="[{$:/temp/plugin-extractor!!plugin}plugintiddlers[]]" variable="tid">
<$checkbox tiddler="$:/temp/plugin-extractor" listField="tiddlers" checked=<<tid>>/> <<tid>><br/>
</$list>

----------
  <% if [enlist{$:/temp/plugin-extractor!!tiddlers}count[]!match[0]] %>
    <$button dragFilter={{{ [{$:/temp/plugin-extractor!!tiddlers}]}}}>Drag <$text text={{{ [enlist{$:/temp/plugin-extractor!!tiddlers}count[]] }}} /> tiddler(s) to another wiki</$button>
  <% endif %>
<% endif %>

You can test this by downloading the following and dragging the resulting file to any wiki:

Plugin Extractor.json (1.3 KB)

2 Likes

Thanks so much, Scott, for posting the program. I’ll check it out as soon as I can.

Have a nice day.

Can I ask why you need them as individual files out of curiosity?

Depending on the various use cases there are other ways and methods available.

Hi Tony.

It’s nothing special. I like to view files in Notepad++, or similar, instead of searching TiddlyWiki for a tiddler to edit, or having to open multiple instances of TiddyWiki to compare code. It’s more convenient for me to learn and test things.

Regards.

Each to their own but there are a range of other possibilities you may be more interested in. I tend to use single file wikis a lot, so have a different perspective. I use TiddlyWiki as the IDE intergrated development environment. Of particular value is;

  • The preview in the editor (including the internals plugin installed at tiddlywiki.com
  • The code mirror plugin
  • External editor
    • I am not sure if its available after recent upgrades to browsers but when NOT using codemirror there are a few browser addons that allow you to edit any text field (tiddler in edit mode) in an external editor, such as Notepadd++ and changes get saved back to the text field.

If you can start to edit tiddlers only within TiddlyWiki it is possible to then leverage a whole range of tools that can make your life a lot easier including syntax highlighting, insert titles via search, drop images into text, autocomplete, custom editor toolbar buttons, custom field editors etc…

It may not meet your needs, but it is possible to search and browse the individual files making up the core plugins from this GitHub page.

GitHub can be intimidating to non-developers, but in this case it is a matter of browsing files in a very similar way to file browsers on Windows/Macs:

Quite a few community plugin authors publish their plugins on GitHub (or equivalent) in the same way.

2 Likes

Hi Jeremy.

I honestly hadn’t considered this option, but after trying it, I see that it does what I need without even having Tiddlywiki open. I’ll go directly to the plugins that their creators have on Github.

Thank you very much, and best regards.

1 Like

@jeremyruston when one does not have a Github location to source Plugin files for node implimentations is there any other method or repository where the files can be shared/located?

  • Eg given a plugin found in a wiki can we generate the files to install that plugin to node?

My feeling there is a gap here that adds confusion especialy to users trying to move into node implementations after becoming familular with single file implementations. There are many plugins not available on Github, or the GitHub location is unknown.

Are you suggesting that Tiddlywiki offer such a facility?

If instead you’re asking if it already exists, then I’m quite sure the answer is “no”. The decentralized nature of TiddlyWiki doesn’t really offer any way to do this.

There would be the possibility of something like Tiddlyhost adding such a feature, but it’s hard to see it generating enough revenue to cover its (likely small) costs.

The only other real possibility I see in the current ecosystem would be if the CPL offered this. I don’t use it or really even understand the CPL, but I’m under the impression that they don’t wait for submissions, actively searching for and importing publicly available plug-ins. If that is correct, then it might be relatively easy for them to add a file system-like interface.

But I still can’t see that as being very important. The OP seems like a fairly niche request. For me personally, if I want to see how a plug-in works, I visit its Contents tab and examine the interesting-looking tiddlers. If the only public version is already compressed/obfuscated, then there really is no way to recover the source code anyway.

It does not seem like a Niche request when it is trending this week, I also wanted to do it (mere coincidence?). The thing is when a gap exists in the methods and documentation it presents a barrier to new and expierenced users understanding and is as likely to turn users off as it is to push them towards a deeper understanding, especialy if that deeper understanding does not have a documented path.

  • Even if occasional (we have no evidence either way) every barrier is a disinsentaive.

This is not niche if moving from Single file to node implementations and is very poorly documented in contrast to the plugin library process.

The title of this Topic “How to extract plugin content” only arrises due to this gap.