A little while ago MarkS helped me with a script that took some tagged
tiddlers and consolidated their contents into another tiddler.  The
script worked well and did as expected.  But for my application it had
some drawbacks.

What I've found is I have to recreate the original named tiddlers for
it to work for me.  I have modified the script to create a section
file from those tiddlers; like so:
--------------------------------------------------------------
<script label="CreateBackupSectionFile">
var out=".";var append="";var tidstitle="";
var title="BackupSectionFile";
var tidstitle=store.getTaggedTiddlers(title);
var append=store.getTiddlerText(title);
var tids=store.getTaggedTiddlers("backup").reverse();
for (var t=0; t<tids.length; t++)
append+="\n"+"!"+(tids[t].title)+"\n"+store.getTiddlerText(tids
[t].title)+"\n"+"!!end"+"\n"+"\n----\n"+"\n";
store.saveTiddler(title,title,append);
return out;
</script>
-------------------------------------------------------------

Now we have a mirrored section file that has captured each tiddler's
contents and put it between  !TiddlerTitle and !!end.  Which is also
an HR separated file as well just for fun, or perhaps useful, but I
don't know if that's useful or not for the next step.

What I need now is to restore those tiddlers from the section file
into the same named real tiddlers again.

The need now is to capture the tiddler title from !TiddlerTitle, name
the tiddler with it, grab the contents up to but not including the !!
end and put the contents into the newly restored tiddler.

Here is a my chopped up script Eric recently did for reading a HR
separated list into a table.  However I suspect this may not be the
tack to take.
---------------------------------------------
<script>
var out="";
var items=store.getTiddlerText('$1','') .split("\n----\n");
for (var i=0; i<items.length; i++) {
if (i>0 && i/3==Math.floor(i/3)) out += "\n"; // start a new row
out += ""+items[i]; // add item to row
 }

Missing:*
out +='Find !TiddlerTitle; get contents up to !!end, discard !!end;
create a tiddler named !TiddlerTitle with contents; do next; then go
back and get the rest,'

store.saveTiddler(title,title,out);
return out;
</script>
----------------------------------------------

Any ideas?

*Remember GWBasic we need GWJavascript ;-)

Morris

--

You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.


Reply via email to