(TWC) Tweak to TagglyTagging

36 views
Skip to first unread message

Dragon Cotterill

unread,
Apr 26, 2017, 7:55:42 AM4/26/17
to tiddly...@googlegroups.com
Just thought I'd offer a tweak to the TagglyTaggingMacro.

As some of you are aware, I mostly use TWC especially for TagglyTagging. http://mptw.tiddlyspot.com/#TagglyTaggingPlugin
However there are times when the tagged content makes the columns uneven. The entries are computed simply by the number of top-level tags. If some of those tags have more an extreme number of tiddlers, then the resulting values can be slewed in totals. I've adapted the "makeColumns" function to count the number of tiddlers in each column and even out the computed values.

Find the makeColumns function in the TT macro and replace thus:

  makeColumns: function(orig,numCols) {
   
var maxLength = orig.join('\n').split('[[').length-1;
   
var maxColLength = Math.floor((maxLength+numCols-1)/(numCols));
   
var output = [];
   
var c = 0;
   
var tot=0;

   
for (var j=0;j<numCols;j++){
     
var singleCol = [];
     
var colTotal = 0;

     
for(;colTotal<maxColLength;){
        singleCol
.push(orig[c]);
        colTotal
+= orig[c++].split('[[').length - 1;
     
}
      tot
+=colTotal;
      maxColLength
= (j == numCols-1) ? maxLength-tot : Math.floor((maxLength-tot)/(numCols-j-1));
      output
.push(singleCol);
   
}
   
return output;
 
},

Not tried it extensively but it seems to work on my TWs. Any comments or improvements gratefully accepted.

-- Dragon.

Reply all
Reply to author
Forward
0 new messages