Custom plugin type

Elsewhere, @btheado wrote:

That’s pretty cool. However,

Either this documentation is wrong:

By default, tiddlers within plugins with custom plugin types will not be registered as shadow tiddlers…
https://tiddlywiki.com/#PluginMechanism

Or, something about your trick doesn’t work as intended.

  1. I created a “plugin” using your method
  2. changed the plugin type to “my-thing”
  3. opened/began editing one of the contained tiddlers…

And TW is warning me I’m editing a shadow tiddler.

Ideas?

I’m not sure your intention behind changing the plugin-type to something custom, but I think the behavior you are seeing can be explained by the fact that when you change plugin-type to plugin, the shadow tiddlers are created. Changing that field again to something else does not undo the shadow tiddler creation. You’d probably have to reload the wiki to get the shadow tiddlers to go away.

If you change the plugin-type directly from import to my-thing, you’ll see the shadow tiddlers are not there.

Which is not what I did. See my steps.

Then I don’t understand your steps.

Step 2 of my method (which you say you followed) involves changing the plugin-type to plugin. Your 2nd bullet point above says you changed the plugin-type field again. That’s why I said “changing that field again…”

Ah, now I see the confusion. I did follow your steps, first time. Worked fine, just like you said it would.

Then, having read the docs, I tried a custom plugin-type. That works, too, except, the contained tiddlers behave like shadows, contrary to how they’re described in the docs:

tiddlers within plugins with custom plugin types will not be registered as shadow tiddlers

In fact, and according to the docs, to make tiddlers within a custom plugin-type behave like regular shadows, you need to take extra steps…

Setting a configuration tiddler $:/config/RegisterPluginType/<plugin-type> to yes will cause the tiddlers within the plugin to be registered as shadow tiddlers.

I took no such steps. Bug, methinks.

All tested at TW .com.

Ref: https://tiddlywiki.com/#PluginMechanism | https://tiddlywiki.com/#Plugin%20Types

Here is a share site link you can use to test.

There are buttons for setting the plugin-type to one of 3 values. Click on my-thing and $:/Import will display like a plugin and claim there are shadow tiddlers, but the links are italics indicating they are missing tiddlers. Since the tiddlers are missing there are no shadow tiddlers and therefore I find the doc to be accurate when it says

tiddlers within plugins with custom plugin types will not be registered as shadow tiddlers

Click the plugin button and the links are no longer italics because the shadow tiddlers now exist (until you delete them or refresh the page).

I’m guessing your complaint is about its claim about the presence shadow tiddlers and requiring the user to notice the italics to realize the shadow tiddlers aren’t really there?

This getting weirder…

which they are at that point.

yet – it’s a pending import.

At THAT point, there are no shadow tiddlers and no plugin, either – it’s a pending import only. If you create a tiddler, test 1, and revert the $:/Import to $:/Import you’ll see the warning appear proving it’s not YET a tiddler in the sense it is being referred to in the docs.

Concession. I had neglected to mention that I had also removed the pending field in my steps, at the same time I changed the plugin-type. But doing that with your testbed did not return the same results. Baffling.

If the docs are wrong, they should be changed (two places).

If the docs are right AND if changing the plugin-type to X is valid/allowed practice, then there is a bug because the spec as implied by the docs is not being followed.

break while I tinker…

Seems as though you can lose the payload (in the sense the tiddlers aren’t created) when you set plugin-type to my-thing. The plugin is not listed in Plugins in control panel, either. The docs don’t make it clear (AFAICT) how to create a custom plugin-type.

Anyway, this is all academic… I don’t even have a busting need to get this working, :wink:

If I go to tiddlywiki.com Advanced search filter for export all [tag[Filter Operators]] then export it to a JSON file. Then also delete the listed tiddlers to remove them from the wiki.

I then reimport them and rename $:/Import to “Filter Operators plugin”, change the plugin type to “data” and remove the status field. Save the tiddler.

  • I now have a “data” plugin and the shadows are listed without italics, they open and read fine.
  • Using the info toolbar button > advanced it now tells me each tiddler is a shadow and comes from “Filter Operators plugin”.

If you use control panel > Plugins you will not see data plugins listed but it is trivial to generate a new tab that does list them separately from plugins, themes and languages.

@TW_Tones If I follow along your steps but use the share link provided by @btheado

rename $:/Import to “thing”, change the plugin type to “data” and remove the status field. Save the tiddler.

  • I now have a “data” plugin and the shadows are listed without italics, they open and read fine.

I now have a “data” plugin but the tiddlers (test 1, test 2) are listed in italics.

  • Using the info toolbar button > advanced it now tells me each tiddler is a shadow and comes from “Filter Operators plugin”.

It tells me each tiddler is a shadow (but italicized).

image

So, Tones, your experience by hand is the same as my experience by hand. But using the share link I cannot repeat the same experience. They shouldn’t be, but the outcomes are different.

What matters here is what happens by hand, not using a contrivance to automate the test which, for reasons I can’t fathom (or care to figure out) doesn’t work.

Late last night I did another test and got the same problem. Not sure why it happens sometimes and not others.

  • I will look into it but not in the next 8 hours