JSZip Plugin: Add ability to build and download ZIP files

This commit is contained in:
jeremy@jermolene.com
2020-05-02 21:22:44 +01:00
parent 85fd43a38c
commit 6a0ff7db18
5 changed files with 173 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
title: $:/plugins/tiddlywiki/jszip/examples
\define actions-render-static-site()
<$action-sendmessage $message="tm-zip-create" $param="$:/temp/_ZipTiddler"/>
<$list filter="[all[tiddlers]!is[system]limit[100]]">
<$action-sendmessage $message="tm-zip-render-file" $param="$:/temp/_ZipTiddler" filename={{{ [<currentTiddler>encodeuricomponent[]addsuffix[.html]] }}} tiddler=<<currentTiddler>> template="$:/core/templates/static.tiddler.html"/>
</$list>
<$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"/>
\end
! Rendering a Static Site to a Zip File
The actions below create a ZIP file containing a static HTML rendering of the first 100 non-system tiddlers:
<pre>
<$text text=<<actions-render-static-site>>/>
</pre>
<$button actions=<<actions-render-static-site>>>
Render site
</$button>
Temporary zip file: $:/temp/_ZipTiddler