Following script should do the trick, if I understood the problem
well:
Install Eric's InlineJavaScriptPlugin:
http://www.tiddlytools.com/#InlineJavascriptPlugin
to use it.
Watch out for the linebreaks !!!!
<script>
var prefix ="list" ; // Use only the tags that start with list
format is list-listnumber-listposition
var out = [] ; var list = {} ; var list_tags = [] ;
var position = [] ;
var tags= store.getTags() ;
// first let get all tags that match the prefix and store them in
list_tags
for (var i = 0 ; i < tags.length; i++) {
var str = new String(tags[i][0]) ;
if(str.startsWith(prefix)) { list_tags.push(str) }
}
// now process the array with list tags, first find all
listnumber
for (var i = 0 ; i < list_tags.length; i++) {
var position = list_tags[i].split('-') ;
if ( !list[position[1]]) { list[position[1]] = [] ; }
list[position[1]].push(list_tags[i]) ;
}
for ( var f in list) {
out.push("*List " + f);
for ( var t = 0 ; t < list[f].length ; t++ ) {
second_list = list[f][t] ;
out.push('**' + second_list ) ;
}}
return out.join('\n');
</script>
Have fun, Okido
On Dec 9, 8:55 pm, Måns <[email protected]> wrote:
> Example:http://tw-abc.tiddlyspot.com/#grupper
>
> On 9 Dec., 17:51, Måns <[email protected]> wrote:
>
>
>
>
>
>
>
> > Quick tables for groups of tags stating with list-x:
>
> > <<forEachTiddler where 'tiddler.tags.join("]]").contains("list-x")&&
> > tiddler.tags.length'
> > sortBy
> > 'getSortedTagsText(tiddler)+"###"+tiddler.title'
> > script
> > 'function getSortedTagsText(tiddler) {var tags = tiddler.tags; if (!
> > tags) return ""; tags.sort(); var result = ""; for (var i = 0; i <
> > tags.length;i++) {result += tags[i]+ " ";} return result;} function
> > getGroupTitle(tiddler, context) {if (!context.lastGroup ||
> > context.lastGroup != getSortedTagsText(tiddler)) { context.lastGroup =
> > getSortedTagsText(tiddler); return "|{{{"+(context.lastGroup?
> > context.lastGroup:"no tags")+"}}}|h\n";} else return "";} '
> > write
> > 'getGroupTitle(tiddler, context)+"|[[" + tiddler.title+"]]|\n"'
>
> > Cheers Måns Mårtensson
>
> > On 9 Dec., 17:34, Måns <[email protected]> wrote:
>
> > > Hi googlepilot
>
> > > We could try to construct it in javascript (Then we might get some
> > > help from someone who knows the language ;-)):
>
> > > Install Eric's
> > > InlineJavaScriptPlugin:http://www.tiddlytools.com/#InlineJavascriptPlugin
>
> > > Write sth like this (seems to work some of the way):
>
> > > <script>
> > > var prefix ="list-x" ;
> > > var out = "" ;
> > > var tags= store.getTags() ;
> > > //wikify(tags,place) ;
> > > for(var i=0;i<tags.length;i++) {
> > > str = new String(tags[i]) ;
> > > if(! str.startsWith(prefix)) continue ;
> > > out+="* <<tag [["+tags[i][0]+"]]>> ("+tags[i][1]+")"+"\n";
>
> > > }
>
> > > return out ;
> > > </script>
>
> > > If we want to create tables - sth like this should be possible (there
> > > are some errors in this attempt and we need HELP*!!):
>
> > > <script>
> > > var prefix ="list-x" ;
> > > var out = "" ;
> > > var hdr="|sortable|k\n| !Tiddler&Tagged | !Number of tagged |h"
> > > out.push(hdr);
> > > var tags= store.getTags() ;
> > > //wikify(tags,place) ;
> > > for(var i=0;i<tags.length;i++) {
> > > str = new String(tags[i]) ;
> > > if(! str.startsWith(prefix)) continue ;
> > > out.push('|<<tag [["+tags[i][0]+"]]>>| ("+tags[i][1]+")"+" |"+'');
> > > }
> > > return out.join('\n');
> > > </script>
>
> > > *Please correct my mistakes - @eric, @mike, @mark, @cmari ....??
>
> > > Cheers Måns Mårtensson
--
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.