[tw5] Re: [TW5] Save Changes button, Action before saving changes

2022-08-22 Thread Ross Table
Thankyou! I think thats going to work!

(Thankyou again as In the mean time I had actually found the tiddler for 
the save button, but, trying to write to $:/state/GMKey BEFORE saving 
wasn't working, well, that or I was doing something wrong... I was probably 
doing something wrong!)

On Monday, August 22, 2022 at 5:45:47 PM UTC+1 Eric Shulman wrote:

> You can prevent a tiddler from being saved in the file by creating a 
> global macro named `publishFilter()` that removes the specific tiddler 
> title, like this:
>
> Create a tiddler (e.g., "MyPublishFilter"), tagged with `$:/tags/Macro`, 
> containing:
> ```
> \define publishFilter()
> -[[$:/state/GMKey]]
> \end
> ```
> The contents of the `publishFilter()` macro are automatically appended to 
> the `saveTiddlerFilter()` filter definition contained in `$:/core/save/all` 
> which is then used by `$:/core/templates/tiddlywiki5.html` to determine 
> which tiddlers will be saved to the TiddlyWiki file.
>
> Notes:
> * Each listed tiddler title should be preceded by a minus sign, so that 
> those titles are excluded from the file.
> * The `publishFilter()` macro can use any valid filter syntax.  Thus, in 
> addition to automatically excluding specific tiddler titles, you can 
> exclude an entire set of matching titles.  For example, if you were to 
> specify `-[prefix[$:/state]]`, then ALL `$:/state` tiddler would be 
> excluded from the file when it is saved.
> * The `publishFilter()` definition doesn't remove the tiddlers from the 
> ***currently loaded*** TiddlyWiki... it just prevents those tiddler from 
> being saved to the file so they won't be there the next time you re-load.
>
> enjoy,
> -e
>

-- 
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/d5d0077d-ded9-4868-8da8-d29b01b373dan%40googlegroups.com.


[tw5] Re: [TW5] Save Changes button, Action before saving changes

2022-08-22 Thread Eric Shulman
You can prevent a tiddler from being saved in the file by creating a global 
macro named `publishFilter()` that removes the specific tiddler title, like 
this:

Create a tiddler (e.g., "MyPublishFilter"), tagged with `$:/tags/Macro`, 
containing:
```
\define publishFilter()
-[[$:/state/GMKey]]
\end
```
The contents of the `publishFilter()` macro are automatically appended to 
the `saveTiddlerFilter()` filter definition contained in `$:/core/save/all` 
which is then used by `$:/core/templates/tiddlywiki5.html` to determine 
which tiddlers will be saved to the TiddlyWiki file.

Notes:
* Each listed tiddler title should be preceded by a minus sign, so that 
those titles are excluded from the file.
* The `publishFilter()` macro can use any valid filter syntax.  Thus, in 
addition to automatically excluding specific tiddler titles, you can 
exclude an entire set of matching titles.  For example, if you were to 
specify `-[prefix[$:/state]]`, then ALL `$:/state` tiddler would be 
excluded from the file when it is saved.
* The `publishFilter()` definition doesn't remove the tiddlers from the 
***currently loaded*** TiddlyWiki... it just prevents those tiddler from 
being saved to the file so they won't be there the next time you re-load.

enjoy,
-e

-- 
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/b92e27a0-4f15-4a2b-a759-64436d078084n%40googlegroups.com.