I’ve just pushed an update that adds a new “slugify” operator to transform 
arbitrary tiddler titles into human readable form for use in filenames or URLs. 
The transformations applied are:
If there is a tiddler with the same title that has a ''slug'' field, then 
return that field instead of running the following steps
Replace uppercase letters with lowercase equivalents
Transliterate diacritics to their basic lowercase ASCII equivalents (for 
example, "Æ" is transliterated to "AE")
Replace spaces with dashes
Remove all non-word characters except dashes and periods
Replace multiple sequential dashes with a single dash
Trim dashes from start and end
If the result is the empty string then character codes are used instead (eg. 
"&£@" transforms to "38-163-64")
There is also a new duplicateslugs operator to detect when multiple tiddlers 
resolve to the same slug.

I’ve also updated the JSZip example to use the slugify operator.

You can try out the update at https://tiddlywiki.com/prerelease

Best wishes

Jeremy.

> On 9 May 2020, at 15:41, Mohammad Rahmani <mohammad.rahm...@gmail.com> wrote:
> 
> Hi Saq,
> 
>  I got it! A million thanks!
> 
> Best wishes
> Mohammad
> 
> 
> On Sat, May 9, 2020 at 7:08 PM Saq Imtiaz <saq.imt...@gmail.com 
> <mailto:saq.imt...@gmail.com>> wrote:
> @Mohammad if the filter returns a path with an "/" in the file name, you 
> create a directory structure. The filter I gave is just an example and users 
> should customize according to their use case.
> 
> Also if you can add a link back to the tiddler on TW scripts that would be 
> very helpful.
> Regards,
> 
> Saq
> 
> On Saturday, May 9, 2020 at 4:28:00 PM UTC+2, Mohammad wrote:
> Many thanks Saq, Briliant!
> 
>  This is really good! I will add this to TW-Scripts!
>   I just missed the part you explained on storing tiddlers in different 
> folders!
> 
> --Mohammad
> 
> On Saturday, May 9, 2020 at 5:05:59 PM UTC+4:30, Saq Imtiaz wrote:
> In summary, if anyone wants to write a guide, to adjust filenames and links 
> (for single file wikis) I recommend this process as per my current 
> understanding:
> create a tiddler called $:/config/static/export-link-filter and place here 
> the filter that will operate on the tiddler title to transform it as you 
> like, this filter will receive the tiddler title as input. For example:
> [split[ ]join[-]encodeuricomponent[]addsuffix[.html]]
> 
> use this filter in the code for your export button:
> 
> \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>subfilter{$:/config/static/export-link-filter}] }}} 
> 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
> 
> <$button actions=<<actions-render-static-site>>>
> Render site
> </$button>
> 
> 
> 3. Create a tiddler called $:/config/static/tv-filter-export-link, with the 
> tag $:/tags/Macro and the content:
> \define tv-filter-export-link() 
> [subfilter{$:/config/static/export-link-filter}]
> 
> This is the same process as what I outlined earlier except, you write the 
> filter once and refer to it in both places, reducing the chances of error.
> 
> Hope this helps,
> Saq
> 
> -- 
> 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+unsubscr...@googlegroups.com 
> <mailto:tiddlywiki+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/166113f6-6502-4693-b891-16f259c96a69%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/166113f6-6502-4693-b891-16f259c96a69%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> -- 
> 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+unsubscr...@googlegroups.com 
> <mailto:tiddlywiki+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMB5CEK0w2B1J%2B-HW4cGLdtTFBSDxSFmX00pYSoJpmGqKw%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMB5CEK0w2B1J%2B-HW4cGLdtTFBSDxSFmX00pYSoJpmGqKw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7607922F-CEC6-414A-8B99-AF4964E052A7%40gmail.com.

Reply via email to