[TW5] Prevent a certain tiddler to be saved

107 views
Skip to first unread message

The Bo

unread,
Apr 21, 2016, 7:06:26 AM4/21/16
to TiddlyWiki
Hello Community,

right now I'm looking for a way to prevent a certain tiddler to be saved.

Cases:
1. Tiddler $:/status/UserName
2. a regular Tiddler (e.g. GettingStarted)

My idea was to set _canonical_uri for the $:/status/UserName to a lokal .tid-file (username.tid) so that the username is transcluded by that file.
After that I saved the wiki and it is working as suggested as long as I save further changes.

I allready tried to modify the $:/core/save/all with -[[$:/status/UserName]] but it seems like the tiddler is deleted after saving.

Is there a way to solve this problem?

Regards,
The Bo

Jeremy Ruston

unread,
Apr 21, 2016, 7:20:20 AM4/21/16
to tiddl...@googlegroups.com
Hi The Bo

One approach would be to construct a plugin that contains your desired value for $:/status/UserName. Then, exclude -[[$:/status/UserName]] from $:/core/save/all. That will ensure that when the tiddler is omitted during the save the shadow will automatically take it’s place.

Are you using the standalone HTML file configuration or Node.js?

Best wishes

Jeremy.

--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/49460099-7ba4-4875-85f6-f5ee1447e370%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

The Bo

unread,
Apr 21, 2016, 7:48:09 AM4/21/16
to TiddlyWiki
Hey Jeremy,

Thank you for your support!

I'm using the standalone html file.
What should the plugin look like and how do I have to implement it?
In fact I think I'm not expierenced enough to create an own plugin.

Regards,
The Bo

Mat

unread,
Apr 21, 2016, 10:15:56 AM4/21/16
to TiddlyWiki
Hi Bo. You should check out this reply from Jeremy in an earlier thread. I believe it is exactly what you're looking for.

<:-)

The Bo

unread,
Apr 22, 2016, 5:16:39 AM4/22/16
to TiddlyWiki
Hi Mat,

thank you! It seems like this will help to create a seperated readonly wiki. But I can't figure out how to implement it to solve this issue

Regards,
The Bo

Jeremy Ruston

unread,
Apr 22, 2016, 10:43:44 AM4/22/16
to tiddl...@googlegroups.com
Hi Bo

What should the plugin look like and how do I have to implement it?

The solution I was proposing there would involve writing some JavaScript, so it may not be a good way to go.

Best wishes

Jeremy

Mat

unread,
Apr 22, 2016, 11:32:49 AM4/22/16
to TiddlyWiki
Ok, I got this to work (copied on Jeremys earlier instructions)

I put this in one tiddler

title: $:/core/save/all

\define saveTiddlerFilter()
[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[[YOURTIDDLER]]  +[sort[title]] $(publishFilter)$
\end
{{$:/
core/templates/tiddlywiki5.html}}

...and this in another

title: MyButton

 
<$button>
   
<$action-sendmessage $message="tm-download-file" $param="<title-of-your-template>" filename="index.html"/>
   
Special Save
</$button>

Comically, I forgot to change the $param so left it with that dummy name.

This saves everything except the marked pink.

<:-)

The Bo

unread,
Apr 27, 2016, 5:30:55 AM4/27/16
to TiddlyWiki
Hey Mat,

it prevents a tiddler to be saved but it doesn't work for the tiddler $:/status/UserName because the tiddler is deleted after saving. So there is no "_canonical_uri" set for the tiddler.

@Jeremy
Ok so that solution is a dead end. Do you have another idea?

Regards,
The Bo

Jeremy Ruston

unread,
Apr 27, 2016, 5:35:42 AM4/27/16
to tiddl...@googlegroups.com
Hi Bo

I think you may need to pull back and describe your overall goals here. Your original post included this idea:

> My idea was to set _canonical_uri for the $:/status/UserName to a lokal .tid-file (username.tid) so that the username is transcluded by that file.

The trouble is that _canonical_uri only works in certain circumstances, and when it does, it works asynchronously. I don’t think you’ll be able to get this to work in the way that you describe. The code that reads the username from that tiddler doesn’t know how to resolve the _canonical_uri field, and as I say, it’s synchronous, so couldn’t work anyway.

Best wishes

Jeremy
Reply all
Reply to author
Forward
0 new messages