Unpacking json plugin file - algorithms for creating tiddlywiki.files

105 views
Skip to first unread message

David Nebauer

unread,
Sep 21, 2019, 9:30:40 PM9/21/19
to TiddlyWiki
I'm playing with a script that unpacks a single json plugin file to individual tiddler files for installing under a node.js server. The script would also create a plugin.info file and, if necessary, a tiddlywiki.files file. (Note that TW is not involved in this process - the script acts directly on the json file.)

I am only using a subset of tiddlywiki.files functionality at the moment - just the 'tiddlers' section with the 'file' and 'fields' fields.

My question is this: is there any way of determining solely from the contents of a tiddler whether its metadata should be provided via the tiddlywiki.files file rather than the tiddler's own file? Another way to put that is: is there an algorithm based on tiddler content that determines whether a tiddler's metadata is provided via the tiddlywiki.files file rather than the tiddler's own file?

Jeremy Ruston

unread,
Sep 22, 2019, 11:44:53 AM9/22/19
to tiddl...@googlegroups.com
Hi David

The tiddlywiki.files mechanism is primarily intended for extracting tiddlers out of existing libraries, without needing to modify those files. It’s a lossy process (because not all the files necessarily end up in tiddlers), and it isn’t generally possible to reconstruct the original files from the extracted tiddlers.

You may be interested in the source for the savewikifolder command which does what you’re trying to do but within TW5:


Best wishes

Jeremy.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a200fbdb-4bfe-4aee-81ec-5d70dae578ed%40googlegroups.com.

David Nebauer

unread,
Oct 7, 2019, 6:28:57 AM10/7/19
to TiddlyWiki
For anyone who finds this topic via a search, after experimenting a bit it turned out the easiest way to extract the content of a single json plugin file is to use the node.js server version of tiddlywiki. Use the following command:

tiddlywiki --import /path/to/plugin/file application/x-tiddler --savewikifolder /path/to/output/folder

Make sure the output folder is empty. The output includes some additional files -- the plugin files will be in a subdirectory of the output folder called plugins/PluginName.

I've attached a script I knocked up to make the process a bit easier.

This topic can be closed (the original poster isn't able to!).

Regards,
David.
tw-unplug
Reply all
Reply to author
Forward
0 new messages