Tiddlywiki JZIP Plugin and tiddlywiki Libraries

90 views
Skip to first unread message

TonyM

unread,
Jul 28, 2020, 10:04:56 PM7/28/20
to TiddlyWikiDev
Folks,

The New JZIP plugin will enable much, Jeremys inclusion of the Render site example very useful.

I am wondering if I could ask if someone familiar with the detailed structure of tiddlywiki libraries, may be able to create a second example, a tool in itself, to generate libraries?

The zip mechanism now allows a suit of files to be generated, including in sub-folders from within a single file (or server) wiki. It would be nice to capture the process into such a tool to democratise the use of libraries for personal and public use. It could also create the library tiddler for sharing at the same time with the provision of the URL

I expect this will prove to be a key method to format and export tiddlywiki content to other multi-file outputs. eg a plain text files in hierarchy of folders.

I certainly will do this in time, but I hope I may be able to avoid the detailed research if someone else has already done it, I am happy to then value add to the solution.

I will be developing another template for static html tiddlers in which all links open the full wiki. Perhaps even generate a site Index, or support SEO metadata.

Regards
TW Tones


TonyM

unread,
Jul 28, 2020, 10:26:27 PM7/28/20
to TiddlyWikiDev
Eg; this nicely zips all currently installed plugins. 

<$action-sendmessage $message="tm-zip-create" $param="$:/temp/_ZipTiddler"/>
<$set name="tv-filter-export-link" value="[slugify[]addsuffix[.html]]">
<$list filter="[is[system]prefix[$:/plugins/]]">
<$action-sendmessage $message="tm-zip-render-file" $param="$:/temp/_ZipTiddler" filename={{{ [
<currentTiddler>slugify[]addsuffix[.html]] }}} tiddler=<<currentTiddler>> template="$:/core/templates/static.tiddler.html"/>
</$list>
</$set>
<$action-sendmessage $message="tm-zip-render-file" $param="$:/temp/_ZipTiddler" filename="static.css" template="$:/core/templates/static.template.css"/>
<$action-sendmessage $message="tm-zip-download" $param="$:/temp/_ZipTiddler" filename="myzip.zip"/>


You could imagine something similar to generate a library, one could bundle plugins for a tiddlywiki edition etc...

Regards
Tony

TonyM

unread,
Jul 28, 2020, 10:37:42 PM7/28/20
to TiddlyWikiDev
Folks,

I am looking here at jeds library maker, hoping to add the generated tiddlers to a zip, may be trivial once I wrap my head around it.

Regards
Tony

TonyM

unread,
Jul 29, 2020, 1:04:49 AM7/29/20
to TiddlyWikiDev
Update,

I almost have the solution mentioned in the First post here. 

Any help appreciated.

Question? Is the urlencoded used in 
<$view field='title' format='urlencoded'/>.json>
Equivalent to +[encodeuri[]]?
  • If not is there an alternative?
  • My tiddlers are breaking into folders and pieces rather than full path filenames.
  • After encoding the path/filename the payload tiddlers are not in the zip.
Another Question,

Is the index.html file what ever I want ?

Regards
Tony

TonyM

unread,
Jul 29, 2020, 3:10:39 AM7/29/20
to TiddlyWikiDev
May I ask

Should the export library filenames for plugins look like this to add to the ZIP?

  • pre-release-plugins/index.html
  • pre-release-plugins/recipes/library/tiddlers.json
  • pre-release-plugins/recipes/library/tiddlers/%24%3A%2Fplugins%2Ftiddlywiki%2Fbrowser-storage.json
  • pre-release-plugins/recipes/library/tiddlers/%24%3A%2Fplugins%2Ftiddlywiki%2Fbrowser-storage%2Fsettings.json
  • pre-release-plugins/recipes/library/tiddlers/%24%3A%2Fplugins%2Ftiddlywiki%2Finternals.json
  • pre-release-plugins/recipes/library/tiddlers/%24%3A%2Fplugins%2Ftiddlywiki%2Fjszip.json
  • pre-release-plugins/recipes/library/tiddlers/%24%3A%2Fplugins%2Ftiddlywiki%2Fshare.json
  • pre-release-plugins/recipes/library/tiddlers/%24%3A%2Fplugins%2Fwikilabs%2Flink-to-tabs.json

Regards
TW Tones

TonyM

unread,
Jul 30, 2020, 10:29:03 PM7/30/20
to TiddlyWikiDev
Folks,

I seem to have almost completed this, but need a little help please.

The result will be an in wiki method to generate plugin libraries, in a zip file for posting online.
  • The problem is when I want to add plugin tiddlers to a ZIP, in fact possibly any tiddler with the "/" in it, even although I use `<$view field='title' jsencoded/>`
    • The tiddlers are saved incorrectly please see attached zip file
    • I can zip other files in their correct folder
  • I have a package attached of my draft work json file
    • Open the tiddler  $

      :/PSaT/library-builder/zip to test

    • Most code is in 

      $

      :/PSaT/library-builder/macros

This requires
  • pre-release
  • JSZip Plugin
Thanks in advance if you can help.

Regards
TW Tones


On Wednesday, July 29, 2020 at 12:04:56 PM UTC+10, TonyM wrote:
library-builder.json
pre-release-plugins.zip

Saq Imtiaz

unread,
Jul 31, 2020, 2:23:01 AM7/31/20
to TiddlyWikiDev
 
    • The tiddlers are saved incorrectly please see attached zip file
Please give an example of your expected outcome and the actual outcome. 

TonyM

unread,
Jul 31, 2020, 3:22:16 AM7/31/20
to TiddlyWikiDev
Saq,

I have discovered there is something broken logically. 

So don't bother for now, thanks for answering.

I will fix that first. However in the zip the plugins are turned into folders with every /'s in their title.

This is one of those rare occasions I will print my code, to revisit variable definitions and logic. 

The trick is getting a file naming standard that is valid
  • To encode in the tiddlers.json (of the Library)
  • Embed in the ZIP file
  • Save on the server (on expanding zip)
  • so the library can retrieve it at a valid URI
Regards
Tony


Tony

Saq Imtiaz

unread,
Jul 31, 2020, 3:52:28 AM7/31/20
to TiddlyWikiDev
The / character is a path separator, so the behaviour of creating subdirectories is correct when such characters are present in a filename.

To use a literal / as part of a filename, use encodeuricomponent.

Reply all
Reply to author
Forward
0 new messages