Tool to compile story or other tiddlers

7 views
Skip to first unread message

Mark S.

unread,
Jan 6, 2010, 2:01:28 PM1/6/10
to TiddlyWiki
I could probably write a script to do this, but just in case -- is
there a plugin or macro that would compile the current story ( or a
given set of tiddlers) into one tiddler?

Thanks!
Mark

Måns

unread,
Jan 6, 2010, 2:13:36 PM1/6/10
to TiddlyWiki

Mark S.

unread,
Jan 6, 2010, 2:43:58 PM1/6/10
to TiddlyWiki
Hi Måns,

Thanks, but that's not what I'm looking for. I don't want to save a
story as a story, I want to compile the contents of the current story
into one tiddler.

My idea here is that if I use tiddlysnip several times on one web
page, I can then pack it all back together into one tiddler. Currently
I would have to do this meticulously by hand.

Thanks,
Mark

On Jan 6, 11:13 am, Måns <humam...@gmail.com> wrote:
> Yep
>
> http://www.tiddlytools.com/#StorySaverPluginhttp://www.tiddlytools.com/#StorySaverPluginInfo

Måns

unread,
Jan 6, 2010, 3:26:17 PM1/6/10
to TiddlyWiki
Ok

Couldn't you speed up the process with StorySaverPlugin?
It gives you a tiddler with a list of wikilinked tiddlertitles for the
current story..
Next step would be to enclose each wikilinked tiddlertitle with the
tiddler macro <<tiddler [[tiddlertitle]]>> - wouldn't it?
Sorry if I don't get the point right...

regards Måns Mårtensson

On 6 Jan., 20:43, "Mark S." <throa...@yahoo.com> wrote:
> Hi Måns,
>
> Thanks, but that's not what I'm looking for. I don't want to save a
> story as a story, I want to compile the contents of the current story
> into one tiddler.
>
> My idea here is that if I use tiddlysnip several times on one web
> page, I can then pack it all back together into one tiddler. Currently
> I would have to do this meticulously by hand.
>
> Thanks,
> Mark
>
> On Jan 6, 11:13 am, Måns <humam...@gmail.com> wrote:
>
> > Yep
>

> >http://www.tiddlytools.com/#StorySaverPluginhttp://www.tiddlytools.co...

Morris Gray

unread,
Jan 6, 2010, 9:44:49 PM1/6/10
to TiddlyWiki

Hi Mark,

I think that would be useful. You helped me with a script a while back
that's almost there.

<script label="Backup">
var out=".";
var append=store.getTiddlerText(title);
var title="NewBackup";
*var tids=store.getTaggedTiddlers("mytag").reverse();*
for (var t=0; t<tids.length; t++)
append+=store.getTiddlerText(tids[t].title)+"\n";
store.saveTiddler(title,title,append);
return out;
</script>

Perhaps you could replace the *store.getTaggedTiddlers* with something
like this.

story.forEachTiddler(
function (title, element) {
out += "[["+title+"]]\n" ;
});

I tried it but am not knowledgeable enough to get the open tiddler
text, but only the titles.

Morris

Mark S.

unread,
Jan 7, 2010, 12:04:16 PM1/7/10
to TiddlyWiki
Well, in case anyone else sees a use for this, here it is. Done as a
inline javascript that needs to be transcluded from a side menu. Like
<<tiddler CompileStory>>. BECAUSE -- you don't want to be compiling
and possibly deleting the tiddler that's running the script! Test
before using, etc.

This takes all the tiddlers in the current story, and packs them into
the top tiddler in the story. There may be other ways that would make
more sense, but that's the way it works at this point. All the other
tiddlers in the story are deleted.

The goal was that, if you have collected a half dozen snippets with
TiddlySnip, that you can quickly pack them into one tiddler. That was
the goal, but I've figured out an entirely different approach to
collecting web info (Using NoteTab pasteboard mode plus "Its all
text").

Mark

<script label="Compile">
//{{{
// This script should not be run from a tiddler that is
// part of the story!
var first = true;
var summaryTitle = "AccidentalTitle" ; // Need more scripting to
protect against empty story
var who, when, out,tags,fields, summaryElement ;
story.forEachTiddler(function(title,ele) {
//tid = story.findContainingTiddler(tid) ;
tid = store.getTiddler(title) ;
if(first) {
//var tid=store.getTiddler(t);
summaryTitle = title ;
summaryElement = ele ;
var who=tid?tid.modifier:config.options.txtUserName;
var when=tid?tid.modified:new Date();
out=tid?tid.text:'' ;
var tags=tid?tid.tags:[];
var fields=tid?tid.fields:{};

first = false ;
} else {
out+=tid.text ;
store.removeTiddler(title) ;
story.closeTiddler(title) ;
}
/*-- FOR LATER get new tags and add to existing tags (if any) */
//var newtags=curTiddler.tagsfield.value.readBracketedList();
//for (var i=0; i<newtags.length; i++) tags.pushUnique(newtags
[i]);
} ) ; // foreach
/* write and show tiddler */
store.saveTiddler(summaryTitle,summaryTitle,out, who, when, tags,
fields);
story.refreshAllTiddlers(true) ;
//story.displayTiddler(story.findContainingTiddler
(summaryElement),summaryTitle);

//}}}
</script>

Måns

unread,
Jan 7, 2010, 1:00:45 PM1/7/10
to TiddlyWiki
Hi Mark

Now I get it :-)
Great idea (and great coding I suppose..)- and thanks for sharing -
However as usual I'm having problems when guessing where the
linebreaks should be.
I'm getting this error: SyntaxError: missing ) after argument list
Here's the script: http://journalermm.tiddlyspot.com/#Compile

Regards Måns Mårtensson

Mark S.

unread,
Jan 7, 2010, 1:51:47 PM1/7/10
to TiddlyWiki
Here, I put it at

http://marksbasement.tiddlyspot.com

Good luck!
Mark

Måns

unread,
Jan 7, 2010, 4:08:14 PM1/7/10
to TiddlyWiki
Thanks Mark

It's a brilliant addition to the backpack of great tools available for
TiddlyWiki.
Eric's SplitTiddler transclusion and your Compile Story script are
good companions...
I often use spreadsheets and other programs to process similar tasks
with tiddlerdata-
with these tools I can stay with TiddlyWiki all the way - I love it! -
Thanks.

Maybe you could even add some of the functionalties from Eric's
SplitTiddler transclusion?
Choose tiddlers to include by title, tags etc - option for setting
linebreaks interval between compiled tiddlers... get a list of
tiddlers to compilation to rearrange order ... that said - I think
your script is doing a great job as it is.

Regards Måns Mårtensson

Reply all
Reply to author
Forward
0 new messages