[TW5] how to sandbox tiddlers

128 views
Skip to first unread message

Danielo Rodríguez

unread,
Sep 30, 2015, 2:05:26 PM9/30/15
to TiddlyWiki
Hello!

I'm working in a project that it is some way similar to the community agregator. It is a wiki that imports tiddlers from different sources, but I don't want those tiddlers to interact too much with the wiki itself.

What I am doing currently is prefixing certain fields names, for example, tags, and prefixing the title value, so I can be sure I will not override any existing tiddler. Is there any other advise you can give me? It is a hard task, because I don't want to be too strict. For example, I want the macros to work, but I don't want to comprise the basic functionality of the main wiki.

As usual, many thanks to anyone that answers.

Regard

Tobias Beer

unread,
Sep 30, 2015, 2:42:44 PM9/30/15
to tiddl...@googlegroups.com
Hi Danielo,

I think we're kinda begging for some sort of "IncludePlugin", one that loads or imports tiddlers from an "external store" while keeping them working alongside those in the wiki. This should obviously not touch any shadow as well as certain system tiddlers.

So, they are there, they are searchable, you possibly won't directly navigate to them as they may in the background due to duplicate names.

Perhaps one way to go about that is to use the plugin mechanism. For example, one could bundle everything via Tinka and then load an external wiki into another one as a plugin. This would make all of its tiddlers available as shadow tiddlers that can at least be accessed via the transclude widget, e.g. in a conditional view-template section.

This would possibly require some more advanced search that allows to navigate to a shadow tiddler of a given package, rather than any "real tiddlers"... or does that work already?

Your idea of some kind of ad-hoc, ui-driven, introspective enhancement of tiddler-data could cater to on-the-fly tag a tiddler before rendering and thus trigger the conditional view-template, whereas the shadow tiddler doesn't even have that tag. Well, or not, because that conditional View-Template can iterate through plugins and retrieve the contents of any shadows by the same name.

Best wishes,

— tb

Mat

unread,
Sep 30, 2015, 4:28:40 PM9/30/15
to TiddlyWiki
Maybe it'd be possible to kind of add your own TW "again" on top, to over-overwrite anything that is overwritten by the foreign TW?

<:-)

PMario

unread,
Sep 30, 2015, 4:41:07 PM9/30/15
to TiddlyWiki
IMO if you need a sandbox, you should use a sandbox.

The $tw.wiki structure is the TW tiddler store, which contains the functions to manipulate tiddlers. It is implemented starting here: https://github.com/Jermolene/TiddlyWiki5/blob/master/boot/boot.js#L850

It may be possible to create sandbox structure, that has less functions. eg: initializing / executing plugins and modules is not be needed in the sandbox. As you write, you don't want to interfere with the existing TW UI. The problem here is, that you'll need some helper functions, that map your sandbox tiddler content into the existing UI, so you can view and edit the content.

IMO prefixing fields to prevent nasty side effects won't help. Since your plugins may be used / imported into TWs, that are heavily customized. So you may run into naming conflicts in the future.

-mario




Danielo Rodríguez

unread,
Oct 1, 2015, 2:47:53 AM10/1/15
to TiddlyWiki


El miércoles, 30 de septiembre de 2015, 22:41:07 (UTC+2), PMario escribió:
IMO if you need a sandbox, you should use a sandbox.

The $tw.wiki structure is the TW tiddler store, which contains the functions to manipulate tiddlers. It is implemented starting here: https://github.com/Jermolene/TiddlyWiki5/blob/master/boot/boot.js#L850

It may be possible to create sandbox structure, that has less functions. eg: initializing / executing plugins and modules is not be needed in the sandbox. As you write, you don't want to interfere with the existing TW UI. The problem here is, that you'll need some helper functions, that map your sandbox tiddler content into the existing UI, so you can view and edit the content.

That is a very interesting idea Mario! If I am understanding you well,you mean that, instead of adding the tiddlers directly to the wiki, I should store them in an alternative store and provide some interface (API) to interact with them. Since this sounds very very interesting and very appropriate it also looks like a lot of work:
 For example, I don't know how to do this without re-writing, or at least extending, every widget that I have to use, and of course re-creating the entire view and edit templates.  How would I for example list tiddlers using the list widget? or the search operator? I'm not asking you for a complete answer :P just your toughs.
Also I don't know how to do some things that requires the tiddler to be on the tiddler store. For example, for rendering a tiddler I add it to the wiki, I call $tw.wiki.renderTiddler with the tiddler tittle and then I delete the tiddler. I would love to be able to do it in other way, But the mechanisms behind render tiddler are too complex.

Would it be, (maybe) enough to just instantiate another wiki object and provide an interface to it?
 



IMO prefixing fields to prevent nasty side effects won't help. Since your plugins may be used / imported into TWs, that are heavily customized. So you may run into naming conflicts in the future.



That is right, but my plugin is not intended to be used in any other wiki, is more like an edition. But, as I said, I still want some interaction, like macros, transclusions and that stuff. Maybe renaming is not the best solution because transclussions and links would stop working. It's hard to determine which levels of "interactivity" to allow !

Many thanks.

Mat

unread,
Oct 1, 2015, 5:15:33 AM10/1/15
to TiddlyWiki
Danielo wrote:
[...]It's hard to determine which levels of "interactivity" to allow !

This difficulty sounds related to the very recent discussion about perhaps categorizing tiddlers according to how sensitive they are to overwrite. (I'm sorry I can't find a link.) Maybe working out a general solution would solve both.

<:-)

Erwan

unread,
Oct 1, 2015, 6:55:28 PM10/1/15
to tiddl...@googlegroups.com

Hi Danielo,

Not sure if this is relevant: Jeremy explained how to "neutralize" imported tiddlers in this post: https://groups.google.com/d/msg/Tiddlywiki/bR9ZozLNadw/tMO5DyJ2b0gJ

Erwan
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/82589368-089f-4eb7-8785-e22379f03bfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Danielo Rodríguez

unread,
Oct 2, 2015, 3:00:51 AM10/2/15
to TiddlyWiki


El viernes, 2 de octubre de 2015, 0:55:28 (UTC+2), Erwan escribió:

Hi Danielo,

Not sure if this is relevant: Jeremy explained how to "neutralize" imported tiddlers in this post: https://groups.google.com/d/msg/Tiddlywiki/bR9ZozLNadw/tMO5DyJ2b0gJ

Erwan

Hello Erwan. Yes, it is relevant. What Jeremy Said, is, more or less what I was doing, so it confirms that I was on the right way. But, your answer is exactly what I was asking for, so thank you very much, and thank you for searching it. 
Reply all
Reply to author
Forward
0 new messages