1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-29 00:33:15 +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 // Server syncing isn't implemented yet
return []; return [];
}, },
tagging: function(wiki,tiddlerTitle) {
return wiki.getTiddlersWithTag(tiddlerTitle);
},
filter: function(wiki) { filter: function(wiki) {
// Filters aren't implemented yet // Filters aren't implemented yet
return []; return [];

View File

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

View File

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

File diff suppressed because one or more lines are too long