[tw5] Re: Get a sanitized filename from a tiddler title

2018-06-19 Thread Marcio Augusto
Hi Jed, Mark, Jeremy and Tony, Well, I finally did it. Created a macro borrowing a couple of lines from the FileSystemAdaptor.prototype.generateTiddlerBaseFilepath you suggested. Although it does what I needed, I realized it is not as general as one could wish, since different tiddler titles

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-06 Thread 'Mark S.' via TiddlyWiki
I know it looks like it just saves the whole wiki, but if you put in some alerts you'll see that it (somehow) gets called when doing exports. It gets called in "download" mode. But the name is the same garbled tiddler name right up to the download "click" action. Which suggests that it is the

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-06 Thread Marcio Augusto
It seems this module is for saving the whole wiki as HTML. Six months ago, I tried to follow the calls in the source code from the "export tiddler" button on, but may have missed the trail at some branch. Spent some more hours on this yesterday, again no luck. To have this sorted out for now, I

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-06 Thread 'Mark S.' via TiddlyWiki
I looked at them. But they don't create the same kind of file name that the browser does when saving exports. In particular, they leave in ? and :, which have to be converted to _ (or something) for saving on Windows. -- Mark On Sunday, May 6, 2018 at 3:37:41 AM UTC-7, Mat wrote: > > On

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-06 Thread Mat
On Saturday, May 5, 2018 at 6:24:49 PM UTC+2, Marcio Augusto wrote: > > If it would be possible to use something from the standard TW (as I am > assuming the "export tiddler" button does), I would like to avoid adding > something that would duplicate a function that already exists. > There are

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-05 Thread 'Mark S.' via TiddlyWiki
It appears that the export/saving occurs in : $:/core/modules/savers/download.js However, it also appears that the conversion to a safe file system name is done by the browser. So it's not available unless there's an equivalent javascript file name conversion function out there somewhere.

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-05 Thread Marcio Augusto
Only if portability is a requirement (which is indeed my case). However, if someone uses TW only on Linux, there would be no need to worry about invalid characters in Windows filenames. Digressions apart, I would like to find the function that does the character conversion on the filename when

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-05 Thread 'Mark S.' via TiddlyWiki
It has to make names that will be valid everywhere. Characters ? and : aren't valid in Windows filenames. On Saturday, May 5, 2018 at 9:34:08 AM UTC-7, Marcio Augusto wrote: > > Anyway, the code you pointed out does exactly what I need. I just could > not find it in the standard TW. > Maybe the

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-05 Thread Marcio Augusto
Anyway, the code you pointed out does exactly what I need. I just could not find it in the standard TW. Maybe the TW just passes the tiddler title "as is" to the browser, which in turn does the invalid character replacement? Although on Linux, even valid characters (like : and ?) gets replaced

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-05 Thread Marcio Augusto
If it would be possible to use something from the standard TW (as I am assuming the "export tiddler" button does), I would like to avoid adding something that would duplicate a function that already exists. On Saturday, May 5, 2018 at 1:04:22 PM UTC-3, Jed Carty wrote: > > What I said in my

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-05 Thread Jed Carty
What I said in my last post only works if you are using it on node and isn't available in the browser. But you could make a javascript macro or widget that uses the same code to have it available in the browser. -- You received this message because you are subscribed to the Google Groups

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-05 Thread Jed Carty
There is a function called generateTiddlerBaseFilepath that is part of the filesystem plugin. Starts on line 118 of this file: https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/filesystem/filesystemadaptor.js If you have the filesystem plugin active (or the multiuser

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-05 Thread Marcio Augusto
Hi Mario, I would like to create a string from the tiddler title, replacing any character invalid in a filename (like <>:"\/|?*^) with an underscore, just like the tiddler export button does. Cheers, Marcio. On Saturday, May 5, 2018 at 12:27:31 PM UTC-3, PMario wrote: > > Hi Marcio, > > What do

[tw5] Re: Get a sanitized filename from a tiddler title

2018-05-05 Thread PMario
Hi Marcio, What do you mean with "sanitized". Can you give some examples? -mario -- 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