1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Use the transclude macro instead of list tagging in the tag popup

This commit is contained in:
Jeremy Ruston 2012-06-19 10:40:30 +01:00
parent ec3f16f50f
commit cabc11d517
4 changed files with 24 additions and 14 deletions

View File

@ -29,9 +29,6 @@ var handlers = {
// Server syncing isn't implemented yet
return [];
},
tagging: function(wiki,tiddlerTitle) {
return wiki.getTiddlersWithTag(tiddlerTitle);
},
filter: function(wiki) {
// Filters aren't implemented yet
return [];

View File

@ -18,7 +18,8 @@ exports.info = {
filter: {byPos: 0, type: "filter"},
title: {byPos: 1, type: "tiddler"},
templateTitle: {byName: true, type: "text"},
templateText: {byName: true, type: "text"}
templateText: {byName: true, type: "text"},
emptyMessage: {byName: true, type: "text"}
}
};
@ -51,14 +52,22 @@ exports.executeMacro = function() {
templateParseTree = this.wiki.parseText("text/x-tiddlywiki","<<view text wikified>>");
}
}
// Render the tiddlers through the template
nodes = [];
for(t=0; t<titles.length; t++) {
title = titles[t];
for(c=0; c<templateParseTree.tree.length; c++) {
node = templateParseTree.tree[c].clone();
node.execute(parents,title);
nodes.push(node);
// Use the empty message if the list is empty
if(titles.length === 0 && this.hasParameter("emptyMessage")) {
nodes = this.wiki.parseText("text/x-tiddlywiki",this.params.emptyMessage).tree;
for(c=0; c<nodes.length; c++) {
nodes[c].execute(this.parents,this.tiddlerTitle);
}
} else {
// Render the tiddlers through the template
nodes = [];
for(t=0; t<titles.length; t++) {
title = titles[t];
for(c=0; c<templateParseTree.tree.length; c++) {
node = templateParseTree.tree[c].clone();
node.execute(parents,title);
nodes.push(node);
}
}
}
// Return

View File

@ -12,7 +12,11 @@ title: $:/templates/TagTemplate
<<reveal state:TagDropDownLocation type:popup qualifyTiddlerTitles:yes><
<div class="open">
{{dropdown-menu{
<<list tagging>>
(((
[is[current]tagging[]]
)) <<view title link>> )
}}}
</div>
>>

File diff suppressed because one or more lines are too long