TW5 Alternatives for TWClassic-Plugins : OpenStory/SaveStory

404 views
Skip to first unread message

Jan Johannpeter

unread,
Apr 27, 2016, 8:07:48 AM4/27/16
to TiddlyWiki
Hello,
I am finally trying to migrate my TWC into TW5. Unfortunately I would need some very plugins which I found on Eric’s TiddlyTools. What I would need most is the OpenStory/SaveStoryPlugins which allows

-to create a button which saves a list of open Tiddlers in a new Tiddler, and (SaveStory)

-to create a button to open all Tiddlers contained in a Tiddler while closing all others. (OpenStory)

I would be very happy, if there was a way to do this.


Yours Jan

Mat

unread,
Apr 27, 2016, 8:59:58 AM4/27/16
to TiddlyWiki

Jan

unread,
Apr 27, 2016, 1:19:05 PM4/27/16
to tiddl...@googlegroups.com
Hi Mat,
thanks for this interesting solution, it seems that here all snapshots are saved in one tiddler.
I need to store each story in a single Tiddler. This is necessary because I have to add metadata to the stories and because I want to be able to exchange these stories with other users of the Project.
Is it possible to change the code
-to create a button which saves a list of open Tiddlers in a new Tiddler, (SaveStory)

\define saveSnapshot()
<$button
set="$:/_snapshots##$(snapText)$"
setTo={{$:/StoryList!!list}}>
{{$:/core/images/done-button}}
Save</$button>
\end

-to create a button to open all Tiddlers contained in a Tiddler while closing all others.(OpenStory)
\define loadSnapshot()
<$button
set="$:/StoryList!!list"
setTo={{$:/_snapshots##$(snapSelect)$}}>
{{$:/core/images/right-arrow}}
Load</$button>
\end
-Jan
--
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/a098f730-cf23-4c0f-ac54-3425487ce93d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark S.

unread,
Apr 27, 2016, 4:06:01 PM4/27/16
to TiddlyWiki
I'm trying to understand your use case. If users have access to your TW, can't they already just use the dropdown list to select and display a particular story? How will having the list in a separate tiddler help you share metadata?

It almost sounds like you want to share not just a list of tiddlers but the contents of the tiddlers as well -- basically an export.

Thanks,
Mark

Jan

unread,
Apr 27, 2016, 6:24:46 PM4/27/16
to tiddl...@googlegroups.com
Hello Mark,
I am working on a collection of excercises for theatre-classes.
Tiddlers describing Exercises are combined for lessons vía stories.
Thus the stories - like shold be tagged to sort them and described which aim shall be achieved.
The idea is to work together on this collection and to exchange exercises and lessons. It is necessary to import just the new storytiddler (and the tiddlers that don't exist yet, but that's another task) in order not to make a mess.
If you are interested  the in TWC version here it  is(alas in german): https://www.dropbox.com/s/837chmzhxky7wjm/DS%20Arbeitsfassung.html?dl=0
If you type storydemo in the searchfield you see the kind of storytiddler I would like to generate. This one was generated automatically which collects information from fields in the tiddlers of the story...

Thanks for your interest
Jan

Mark S.

unread,
Apr 27, 2016, 10:15:20 PM4/27/16
to TiddlyWiki
Hello,

Technically, this modification of matebele's version does just what you want:

\define saveSnapshot()
<$button> Save Snapshot
<$action-setfield $tiddler="$(snapshot)$" $field="text" $value={{$:/StoryList!!list}} tags="Snapshot">
</
$button>
\end

\define showSnapshot()
<$button set="$:/StoryList!!list" setTo={{$(snap)$}}>Show Snapshot</$button>
\end

;Show Snapshot

<span title="Select a Snapshot"><$select tiddler="$:/
_snapshots" field="story-name" default='(none)'>
<$list filter="
[tag[Snapshot]]" variable="currentIndex">
<option value=<<currentIndex>>><<currentIndex>></option>
</$list>
</$select></span>
<$set name="
snap" value={{$:/_snapshots!!story-name}}>
<<showSnapshot>>
</$set>

;Save Snapshot

<span title="
Enter a Name"><$edit-text tiddler="$:/_snapshots" field="story-name"/></span>
<$set name="snapshot" value={{$:/_snapshots!!story-name}}>
<<saveSnapshot >>
</
$set>

Be sure to back up before trying this! You will need to create an additional tiddler $:/_snapshots.

But I'm guessing that you won't like the way it works -- all the tiddlers are listed one after another in a single line rather than in list. I imagine it will take a javáscript macro to be able to make it into a standard list.

Mark

Jan

unread,
Apr 29, 2016, 8:10:30 PM4/29/16
to tiddl...@googlegroups.com
Hello,
I think I would like to do a solution with a small detour:
1. Create a ShadowTiddler called [[Snapshot]] which contains the Story like this:
     {{{[split:list{$:/StoryList!!list}]}}}
     Question: How can I exclude the Tiddlers Tagged with excludeStory?

2. How can set the value of
<$action-setfield $tiddler="$(snapshot)$" $field="text" $value tags="Snapshot">
to the clickyfied Text of [[Snapshot]]

Thanks...
Jan




Am 28.04.2016 um 04:15 schrieb 'Mark S.' via TiddlyWiki:
Hello,

Technically, this modification of matebele's version does just what you want:

\define saveSnapshot()
<$button> Save Snapshot
<$action-setfield $tiddler="$(snapshot)$" $field="text" $value tags="Snapshot">
</
$button>

Mark S.

unread,
Apr 29, 2016, 11:44:59 PM4/29/16
to TiddlyWiki
Hello Jan,

I don't think there is a "split" operator -- at least it's not mentioned in the docs.

And I don't think you can capture the nicely formatted list and tuck it into a tiddler. It would be cool if you could.

But I think what you could do is save your stories in the list field of tiddlers. Then set up a Conditional Template that would display the tiddlers almost the way you are doing here. See Tobias Beer's site "http://tobibeer.github.io/tb5/#Conditional ViewTemplate Section" for details on Conditional Templates.

Change your previous code to save lists in the list field of the snapshot tiddlers instead of in the text field.

Set up your view template so that it displays any tiddler having the tag "Snapshot" and contains a list. You would have something like this:

<$list filter="[all[current]tag[Snapshot]has[list]]">
<$list filter="[list[]!tag[excludeStory]]"><$link><$view field="title"/></$link>
<br/></$list>
</$list>

Now when you view the snapshot tiddlers, you'll see the story list you want in a nice linked list, minus any tiddlers that have been excluded with the tag "excludeStory".

HTH
Mark

Jan

unread,
May 2, 2016, 8:34:37 AM5/2/16
to tiddl...@googlegroups.com
Hello Mark,
Thanks for your help and sorry for not answering more quickly.
I did not know ther was so much difference between TWC and TW5.
I´ll have to do a lot of learning if i really change.
I could not get your solution to work properly.

Am 30.04.2016 um 05:44 schrieb 'Mark S.' via TiddlyWiki:
I don't think there is a "split" operator -- at least it's not mentioned in the docs.
That's a plugin by Tobias.... $:/plugins/tobibeer/split
And I don't think you can capture the nicely formatted list and tuck it into a tiddler. It would be cool if you could.
That's a pitty, in Tiddlytools for classic ther was a plugin called "clickify" which did exactly this

In TWC the solution was the following:
<<clickify newTiddler
   label:"save story!" focus:title tag:snapshot
   title:{{prompt('Please enter a name','')}}
   text:{{
      var out="";
      story.forEachTiddler(function(t){
   var tid=store.getTiddler(t);
    if(tid&&!tid.isTagged("excludeStory"))
      out+="[["+t+"]]\n";});
     out += '\n' + store.getTiddlerText('openStoryTemplate') ##which inserts the textfield of the Template and creates a button to open the story##
      out;
   }}>>

By the template this
<<openStory {{tiddler.title}}>>
was inserted into each created SnapshotTiddler to open the story contained...

Thanks again,
Jan











Mark S.

unread,
May 2, 2016, 1:08:19 PM5/2/16
to TiddlyWiki
Here's a json with the updated save/show routines and with the suggested view template. Be sure to back up before trying.

I can imagine several ways in which this might not work as you wanted, so you will need to specify how it is not working properly.

It might be possible to create a wikified list with a javascript macro. But I'm thinking that you want your users to edit that list in the text editor. So that would take a second javascript macro to parse the human readable list back into the kind of lists used to save stories. Have to think about that.

Good luck,
Mark

In general, I think TWC was favorable in many ways to TW5.
TW5_Project_Snapshot.json

Jan

unread,
May 2, 2016, 4:20:06 PM5/2/16
to TiddlyWiki
Hi Mark,
Thanks for the .json
The view-template works fine, it creates a neat row and tiddlers tagged with excludeStory are not shown, but they are saved in the list and are opened when you load the story.
For my purpose would be best to exclude them at once...
I understand that the Problem is in opening tiddlers contained in the textfield if they are not properly  aligned. In TWC the tiddlytools StorySaverPlugin managed this...http://www.tiddlytools.com/#StorySaverPlugin
Yours Jan


-------- Weitergeleitete Nachricht --------
Betreff: Re: [tw] Re: TW5 Alternatives for TWClassic-Plugins : OpenStory/SaveStory
Datum: Mon, 2 May 2016 10:08:18 -0700 (PDT)
Von: 'Mark S.' via TiddlyWiki <tiddl...@googlegroups.com>
Antwort an: tiddl...@googlegroups.com
An: TiddlyWiki <tiddl...@googlegroups.com>
TW5_Project_Snapshot.json

Mark S.

unread,
May 2, 2016, 5:12:19 PM5/2/16
to TiddlyWiki
The attached version will apply the excludeStory tiddlers before saving the story in the list.

Mark


On Monday, May 2, 2016 at 1:20:06 PM UTC-7, Jan wrote:
Hi Mark,
Thanks for the .json
The view-template works fine, it creates a neat row and tiddlers tagged with excludeStory are not shown, but they are saved in the list and are opened when you load the story.
For my purpose would be best to exclude them at once...
I understand that the Problem is in opening tiddlers contained in the textfield if they are not properly  aligned. In TWC the tiddlytools StorySaverPlugin managed this...http://www.tiddlytools.com/#StorySaverPlugin
Yours Jan


-------- Weitergeleitete Nachricht --------
Betreff: Re: [tw] Re: TW5 Alternatives for TWClassic-Plugins : OpenStory/SaveStory
Datum: Mon, 2 May 2016 10:08:18 -0700 (PDT)
Von: 'Mark S.' via TiddlyWiki <tidd...@googlegroups.com>
Antwort an: tiddl...@googlegroups.com
An: TiddlyWiki <tidd...@googlegroups.com>
...
TW5_Project_Snapshot_v3.json

Mark S.

unread,
May 3, 2016, 12:08:35 AM5/3/16
to TiddlyWiki
This version is a little more experimental, and maybe a little more likely to break. It doesn't use the View Template, which you can turn off. It stores a physical copy of a bulleted list in the text field of the save tiddler for easy editing. BUT, it still restores from the list field. One step at a time ...

Mark
TW5_Project_Snapshot_v4.json

Jan

unread,
May 3, 2016, 10:17:52 AM5/3/16
to tiddl...@googlegroups.com
Hi Mark,
This one works perfect!
Thanks a lot, I am admiring your patience with me.

Yours Jan

Jan

unread,
May 4, 2016, 11:35:05 AM5/4/16
to tiddl...@googlegroups.com
Hello Mark,
now I had the time to try out both attemps. They both work very good. Many thanks for this.
Do you want to make them accessible for the community by turning them into a plugin, I think this could be useful for some of us?

I like your first solution (V3) better, I think it could even be an advantage that the tiddlers are stored in a list-field.
-Would it be possible to give this List-field a custom name for example "story"?
-Would it be possible to implement a button to open the story in the viewTemplate so that it appears below the List of tiddlers?

and I encountered another issue:
Is it possible to rearrange the tiddlers by drag and drop like it was with the rearrangeTiddlersPugin in TiddlyTools?
I think it might be better to post this as a new question.

Cheerio and Thanks
Jan

Mark S.

unread,
May 4, 2016, 2:28:22 PM5/4/16
to tiddl...@googlegroups.com
Hah! I bet this isn't what you really wanted ;-)

You can drag-n-drop the EXPERIMENTAL plugin from http://mashive.tiddlyspot.com/.

The list is now stored in field "story". The view template includes a button to open everything in a snapshot. Probably need to tweak that eventually.

Have fun,
Mark

Edit: Yes, you will have to ask in the forum about rearranging tiddlers in the story. That was a great feature available to TWC.
Message has been deleted

Jan

unread,
May 4, 2016, 7:48:15 PM5/4/16
to tiddl...@googlegroups.com
Hi Mark!
It is exactly what I really wanted...It's wonderfull.
So far the .jsons were more comfortable to implement, I somehow didn't manage to install directly from the URL. Exporting and reimporting the jsons it works perfect.
Thanks and cheerio.
Jan

PS.
The remaining desires to this plugin beginn to get really odd: If the name in the save-story-field already exists as a tiddler, it would be useful to change the button-label from "save" to "overstore" and perhaps even turn it red...







Am 04.05.2016 um 20:28 schrieb 'Mark S.' via TiddlyWiki:
Hah! I bet this isn't what you really wanted ;-)

You can drag-n-drop the EXPERIMENTAL plugin from http://mashive.tiddlyspot.com/.

The list is now stored in field "story". The view template includes a button to open everything in a snapshot. Probably need to tweak that eventually.

Have fun,
Mark

On Wednesday, May 4, 2016 at 8:35:05 AM UTC-7, Jan wrote:
Hello Mark,
now I had the time to try out both attemps. They both work very good. Many thanks for this.
Do you want to make them accessible for the community by turning them into a plugin, I think this could be useful for some of us?

I like your first solution (V3) better, I think it could even be an advantage that the tiddlers are stored in a list-field.
-Would it be possible to give this List-field a custom name for example "story"?
-Would it be possible to implement a button to open the story in the viewTemplate so that it appears below the List of tiddlers?

and I encountered another issue:
Is it possible to rearrange the tiddlers by drag and drop like it was with the rearrangeTiddlersPugin in TiddlyTools?
I think it might be better to post this as a new question.

Cheerio and Thanks
Jan

On Monday, May 2, 2016 at 5:34:37 AM UTC-7, Jan wrote:
Hello Mark,
On Wednesday, April 27, 2016 at 3:24:46 PM UTC-7, Jan wrote:
Hello Mark,
...
--
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.

Jan

unread,
May 28, 2016, 4:35:44 PM5/28/16
to tiddl...@googlegroups.com
Dear Mark,
I just pinned your StorySaver V3 from http://mashive.tiddlyspot.com/ to my sidebar and realized a bug:
The button behind the dropdownmenu always opens the story that was saved last, not the one chosen...
I didn't notive this at first becaus this is the version in which you implemented the button on top of the list in the story-tiddler which works very fine...
It woult be suberbe if you fixed this and perhaps you could add a check/warning behind the Save-Snapshot-button like this one:

\define check-title()
<$list filter="[all[current]get[draft.title]is[tiddler]]">This Tiddler already exists, you're going to overwrite it...<br>View it first? ><$link><$view field="title"/></$link>
</$list>
\end

best wishes
Jan



Am 04.05.2016 um 20:28 schrieb 'Mark S.' via TiddlyWiki:
Hah! I bet this isn't what you really wanted ;-)

You can drag-n-drop the EXPERIMENTAL plugin from http://mashive.tiddlyspot.com/.

The list is now stored in field "story". The view template includes a button to open everything in a snapshot. Probably need to tweak that eventually.

Have fun,
Mark

On Wednesday, May 4, 2016 at 8:35:05 AM UTC-7, Jan wrote:
Hello Mark,
now I had the time to try out both attemps. They both work very good. Many thanks for this.
Do you want to make them accessible for the community by turning them into a plugin, I think this could be useful for some of us?

I like your first solution (V3) better, I think it could even be an advantage that the tiddlers are stored in a list-field.
-Would it be possible to give this List-field a custom name for example "story"?
-Would it be possible to implement a button to open the story in the viewTemplate so that it appears below the List of tiddlers?

and I encountered another issue:
Is it possible to rearrange the tiddlers by drag and drop like it was with the rearrangeTiddlersPugin in TiddlyTools?
I think it might be better to post this as a new question.

Cheerio and Thanks
Jan

On Monday, May 2, 2016 at 5:34:37 AM UTC-7, Jan wrote:
Hello Mark,
On Wednesday, April 27, 2016 at 3:24:46 PM UTC-7, Jan wrote:
Hello Mark,
...
--
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.

Mark S.

unread,
May 30, 2016, 12:53:43 AM5/30/16
to TiddlyWiki
Hi Jan,


I've made some updates at mashive. You can try dragging and dropping the plugin or grabbing the new "Story Saver with Mods" which should automatically go into the sidebar.

Be sure to back up first!

Good luck!
Mark

Jan

unread,
May 30, 2016, 4:05:00 AM5/30/16
to tiddl...@googlegroups.com
Hi Mark.
Thank you so much for your help. The buttons on top of the Lists work perfect. Unfortunately the behaviour of the button after the dropdownlist is still the same.
I think I found the source of this: The button opens the story of the Tiddler in the input field and not the one in the dropdownmenu.

all the best Jan

Mark S.

unread,
May 30, 2016, 1:30:47 PM5/30/16
to TiddlyWiki
Hi Jan,

Are you sure you brought over/replaced the existing tiddlers? The plugin should provide "Story Saver with Mods" and "Template for Viewing Snapshots". If you have older tiddlers in your TW, I'm not sure which one wins.
 
It seems to work the way I would expect at Mashive. When you enter a new snapshot and save, the one you just saved as becomes the one shown in the drop-down list. If you manually type in the name of an existing snapshot, it also gets selected in the drop-down list. If you type in an existing name, it also warns you that you are about to overwrite an existing tiddler. If you are not seeing this behavior, then perhaps you could take a screen shot. Or if you are expecting some other behavior, perhaps you could explain again.

Thanks -
Mark

Jan

unread,
May 30, 2016, 7:19:33 PM5/30/16
to tiddl...@googlegroups.com
Hi Mark,
I tried the following at mashive (to exclude that the Problem is due to my configuration)
Create TiddlerA  to distiguish the stories, Save StoryA with TiddlerA, save StoryB without TiddlerA, open StoryA. TiddlerA should be present but it is not.

Could it be the problem that the Variables snap and snapshot have the same value?
<$set name="snap" value={{$:/_snapshots_name!!storyname}}>
When I changed  unfortunately it had a kind of random effect. 

Thanks and good Luck
Jan

Mark S.

unread,
May 30, 2016, 8:15:25 PM5/30/16
to TiddlyWiki
The hardest kind of problems to fix are where you can't reproduce the problem.

When I try your scenario, and click on the selection for story A from the drop-down list, TiddlerA always appears in the story -- without fail.

It occurred to me that you might have been referring to opening Story A from the StoryA tiddler as well, so I tried it that way as well. TiddlerA is always included in the story.

Also, just in case we have a misunderstanding about how it is to be used (since it might work differently from Classic) you have to select the story from the drop down list, and THEN click on Show Snapshot.

I've saved my versions of TiddlerA, TiddlerB, Snap A, and Snap B on MasHive for you to check out and confirm that we're looking at the same thing.

What browser and operating system are you using?

Good luck!
Mark

Jan

unread,
May 31, 2016, 5:00:19 AM5/31/16
to tiddl...@googlegroups.com
Hi Mark,
Thanks for this Version and for implementing the warning!
What you can see in your demo is that the the Show'Dropdown and the Save'InputField are linked, when you change the dropdown the Text in the TypeBox changes.  It is the text in the type box which determines what ist opened: If you input something that is not the name of a snapshottiddler and then press ShowSnapshot the story vanishes. In the long run I would try to unlink the Fields. For security reasons it would be best if the save'Inputfield was empty by default.
But this one is near perfect and i will immediately install it.

Thanks a lot for your dedication
Yours Jan

Mark S.

unread,
May 31, 2016, 11:03:20 AM5/31/16
to TiddlyWiki
There's a reason they are linked. Perhaps I misunderstood, but earlier you said that you wanted the drop-down list to show the last item that had been created by way of the entry box. Connecting them means that whatever is created in the entry box automatically becomes selected in the drop-down. I'll have to think if there is some other way I could connect them.

Thanks,
Mark

Jan

unread,
May 31, 2016, 8:21:16 PM5/31/16
to tiddl...@googlegroups.com
Hi Mark,
Did I say so? I think I may have explained something the wrong way.
If I should wish a perfect behaviour of the SaveStoryField I would like it to be empty at first with a dropdownlist with the existing stories sorted by ModificationDate.
But I now have come to like the behaviour has, It is already very practical for me. (The only danger was in accidentally overwriting stories, your warning makes this a lot better and I modified this part of your storysaver to hide behind a slider...)

Again many thanks, great work!

best wishes
Jan

Jan

unread,
Jun 4, 2016, 9:01:37 AM6/4/16
to tiddl...@googlegroups.com
Hello Mark, Hello all
I made some changes to Mark's/Tobi's StorySaverMacro,
These regard design, languages and I cut it in two parts "SaveAStory" and "LoadAStory" to be able to implement the elements in other scenarios.
The two are transcluded into a "stories"-sidebar.
The localized Phrase for "load a story" has to be set because i could not find anything similar in the /language-files.
The .json-File to install it can be downloaded here: 
https://www.dropbox.com/s/fowua325b408gff/storysaver.json?dl=0
I hope you like it.


best wishes
Jan
Reply all
Reply to author
Forward
0 new messages