Hello everyone,

I wish to use tiddlywiki as a semi-private blog using GitHub Pages (with 
some of its content never going online until it's ready) and thought it 
would be nice to have a button that allow to choose what saver to use.

For example, when I'm finished working on my article, I would hit the 
regular save button and the changes would be saved locally. Then, when I'm 
satisfied, I would click a button to save to GitHub.

The interesting thing is that we can set a filter to exclude some tiddler 
from the save, so if I want to exclude an unfinished tiddler from the save 
to GitHub, I would simply tag it with “private” or something before saving 
the wiki.

The issue is : tiddlywiki does not provide a mean to specify which saver to 
use when triggering a save. 

I found a workaround : I use a button which first fill in the GitHub 
credential, increasing the priority of the GitHub saver, trigger the 
filtered save, then remove the credential, allowing the next regular save 
to be done with the local saver.

The issue is that when I save to github this way, it also save locally. So 
to prevent my private tiddlers from getting overridden by the save, I need 
to trigger a complete save to finish the process. I think this is very 
risky because if the browser crash between the github save and the local 
save, all my private tiddlers will be lost. It would be best if I could 
save only to github thus never overriding my local wiki. Is that possible ?

I've found this js code by bimlas showing how to select a saver : 
https://bimlas.gitlab.io/demo/tw5/preferred-saver.html#%24%3A%2Fbimlas%2Fpreferred-saver.js
 
but I don't know how to adapt it to my scenario.

Here's the code that I use for now :

<$button tooltip={{GithubSave/Hint}} aria-label={{GithubSave/Caption}}  
class=<<tv-config-toolbar-class>>>
<$action-listops $tiddler="github save button/private/username" 
$tags="[[private]] [[github save button]]"/>
<$action-listops $tiddler="github save button/private/state" 
$tags="[[private]] [[github save button]]"/>
<$action-setfield $tiddler="$:/GitHub/Username" text={{github save 
button/private/username}}/>
<$action-sendmessage $message="tm-save-wiki" $param="$:/core/save/all" 
publishFilter={{publishFilter}} />
<$action-setfield $tiddler="$:/GitHub/Username" text=""/>
<$action-sendmessage $message="tm-save-wiki" $param="$:/core/save/all"/>

<span class="tc-dirty-indicator">
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
{{$:/core/images/github}}
</$list>
<$list filter="[<tv-config-toolbar-text>match[yes]]">
<span class="tc-btn-text">save to github</span>
</$list>
</span>
</$button>

Live demo : 

https://telumire.github.io/TW-tips/#Save%20a%20private%20copy%20to%20github%20(single%20file%20wiki)

You can import it in your wiki by drag & drop "'open all in the current 
tab" in tiddlywiki. Click once on the button, then fill in the username in 
the tiddler "github save button/private/username". 

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a280b63c-0425-4cf7-b1b0-dd005b6534fbn%40googlegroups.com.

Reply via email to