1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +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() \define actions-render-static-site()
<$action-sendmessage $message="tm-zip-create" $param="$:/temp/_ZipTiddler"/> <$action-sendmessage $message="tm-zip-create" $param="$:/temp/_ZipTiddler"/>
<$list filter="[all[tiddlers]!is[system]limit[100]]"> <$set name="tv-filter-export-link" value="[slugify[]addsuffix[.html]]">
<$action-sendmessage $message="tm-zip-render-file" $param="$:/temp/_ZipTiddler" filename={{{ [<currentTiddler>encodeuricomponent[]addsuffix[.html]] }}} tiddler=<<currentTiddler>> template="$:/core/templates/static.tiddler.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> </$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-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"/> <$action-sendmessage $message="tm-zip-download" $param="$:/temp/_ZipTiddler" filename="myzip.zip"/>
\end \end
@ -21,4 +23,14 @@ The actions below create a ZIP file containing a static HTML rendering of the fi
Render site Render site
</$button> </$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 Temporary zip file: $:/temp/_ZipTiddler

View File

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