PMario, you da man!

For posterity - the purpose of this exercise is to allow a TW to act/
look like a blog at startup - it may have all kinds of other tiddler
types, but the standard "journal" entries will now appear on the front
page at startup. Any type of tiddler can be tagged "default" and it
will appear at the top of the list - like a blog or forum's "sticky"
tag, and all the rest of the unarchived journal entries sort in
reverse date order below.

So my workflow is to use a GTD-style project/action TW, combined with
journaling - unstructured notes about various things - tagged by
project, progress on habit control/formation routines etc.

Every once in a while I parse the recent journal entries for new
projects/actions, extract important notes to structured reference
files etc - when I've finished extracting everything important from
that journal entry I tag it "archived" and it no longer shows up on
the home page.

A thing of beauty, thank you PMario!

And thanks also for the JS reference links; I hope one day I'm in a
position to start learning programming - my understanding is that JS
isn't the best first language though?

On Jun 14, 6:55 pm, PMario <[email protected]> wrote:
> On Jun 14, 5:37 am, HansBKK <[email protected]> wrote:> Very cool, we're 
> getting there. Now to be able to create multiple sets and
> > control the ordering. . .
>
> > Neither of the below work, because (obviously) me have no JS.
>
> but the spirit :)
>
> try this.http://pastebin.com/ihKjWYgY
>
> If you are interested, what's going on, read the following.
> Otherwise just have fun! :)
>
> ====
> some info, what's going on.
>
> store.getMatchingTiddlers() returns an array of objects
> eg:
> [ {title: "New Tiddler", modified: 20110614120000, created ...},
> {title: "New Tiddler1", modified: 20110614120000, created ...} ]
>
> ====
> .reverse(); .. reverses the sort order
>
> store.getMatchingTiddlers("default","-modified") .. does the same :)
> see the minus in front of "-modified".
>
> ====
> so tids1 and tids2 are arrays of objects
> we can combine two arrays with concat().
>
> var tids = []
> tids = tids.concat(tids1,tids2);
>
> ====
>
> map() function can manipulate arrays. In our case it returns the title
> of the tids objects.
>
> The following line is very hacky, because it converts the "object
> tids" into an "array tids". Sorry for this, but it saves a variable.
>
> tids = tids.map(function(elem){return elem.title})
> ====
>
> join() can take arrays and create a string
>
> ["text 1", "text 2"].join(']] [[') creates
> "text 1]] [[text 2"
>
> '[[' + join() + ']]' ... fixes the front and the end of the string
>
> et voila:
> config.shadowTiddlers["DefaultTiddlers"] = '[[' + tids.join(']] [[') +
> ']]';
>
> hope this helps
> -m

-- 
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