1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Add slugify operator to JSZip static export example

This commit is contained in:
jeremy@jermolene.com 2020-05-09 15:56:48 +01:00
parent 4966f6ab62
commit 2eb11d9a2d
2 changed files with 15 additions and 2 deletions

View File

@ -2,9 +2,11 @@ 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"/>
<$set name="tv-filter-export-link" value="[slugify[]addsuffix[.html]]">
<$list filter="[all[tiddlers]!is[system]limit[25]]">
<$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"/>
\end
@ -21,4 +23,14 @@ The actions below create a ZIP file containing a static HTML rendering of the fi
Render site
</$button>
'<$list filter="[!is[system]duplicateslugs[]limit[1]]" emptyMessage="(There are no duplicate slugs)">
The following tiddlers have duplicate slugs:
<ul>
<$list filter="[all[tiddlers]!is[system]limit[25]duplicateslugs[]]">
<li><$link><$text text=<<currentTiddler>>/></$link></li>
</$list>
</ul>
</$list>
Temporary zip file: $:/temp/_ZipTiddler

View File

@ -44,6 +44,7 @@ exports.startup = function() {
templateTitle = paramObject.template,
text = $tw.wiki.renderTiddler(outputType,templateTitle,{
parseAsInline: paramObject.mode === "inline",
parentWidget: event.widget,
variables: {
currentTiddler: paramObject.tiddler
}