I work a lot with Nicos excellent Projectify plugin. 

As a result, I have a lot of ephemeral tiddlers for my to-dos that once 
done, are no longer really needed as full tiddlers. I don't need to search 
them, tag them, etc. 

Also, since I use node, I don't really want them cluttering the tiddlers 
folder, as I frequently go in there and do some searching outside TW.

As a result, I thought about "Archiving" them, or "flattening" them, into a 
single JSON tiddler for reference. 

I came up with the following "Archive" button, which appends all tiddlers 
tagged with done to an Archive tiddler. 

Code:
<$vars archiveTiddlerTitle="Archive" 
       todoText=<<jsontiddlers "[tag[done]]" >> 
       emptyJSON="[]" linebreak="

"> 
    <$set name="newArchiveText" 
          filter="[<todoText>!match<emptyJSON>]" 
          value={{{ 
[title<archiveTiddlerTitle>get[text]addsuffix<linebreak>addsuffix<todoText>] 
}}} 
          emptyValue={{{ [title<archiveTiddlerTitle>get[text]] }}} >

        <$button>
            <$action-setfield $tiddler=<<archiveTiddlerTitle>> 
                              $field="text" 
                              $value=<<newArchiveText>> />
            <$action-deletetiddler $filter="[tag[done]]" />           
            Archive! 
        </$button>

    </$set>
</$vars>


Some notes:

   - I had to solve an annoying issue with the <<jsontiddlers>> macro that 
   when its empty, returns an "[]", which is actually not empty (is this 
   intended?!) 
   - Different archiving batches will just be appended as separate JSON 
   objects, instead of merging everything back into one large JSON object.
   - There is no "unarchive" feature, and building one is probably beyond 
   my abilities (thought might be a good use case for Joshua's JSON Mangler! 
   if I understand it correctly!)


This could be of use for others to "flatten" large tag structures that 
you're done with and don't need flying around as separate tiddlers. 

Your thoughts/suggestions/comments/etc are welcome!

Diego

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/d14c93ef-456d-40cf-a51c-698c77c579adn%40googlegroups.com.

Reply via email to