1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-29 11:30:28 +00:00

Fixed timeline macro to exclude tiddlers that lack the target field

This commit is contained in:
Jeremy Ruston 2011-12-17 10:55:53 +00:00
parent f0e9c4e7ff
commit 4217ee3ccc
2 changed files with 22 additions and 16 deletions

View File

@ -190,22 +190,27 @@ WikiTextRenderer.macros = {
var tiddler = tiddlers[t], var tiddler = tiddlers[t],
theGroupParseTree = this.parser.processor.textProcessors.parse(groupTemplateType,groupTemplateText), theGroupParseTree = this.parser.processor.textProcessors.parse(groupTemplateType,groupTemplateText),
theGroup = theGroupParseTree.render("text/plain",theGroupParseTree.children,this.store,tiddler); theGroup = theGroupParseTree.render("text/plain",theGroupParseTree.children,this.store,tiddler);
if(theGroup !== "") {
if(ul === undefined || theGroup != lastGroup) { if(ul === undefined || theGroup != lastGroup) {
ul = {type: "ul", attributes: {"class": "timeline"}, children: []}; ul = {type: "ul", attributes: {"class": "timeline"}, children: []};
macroNode.output.push(ul); macroNode.output.push(ul);
ul.children.push({type: "li", attributes: {"class": "listTitle"}, children: [{type: "text", value: theGroup}]}); ul.children.push({type: "li", attributes: {"class": "listTitle"}, children: [{type: "text", value: theGroup}]});
lastGroup = theGroup; lastGroup = theGroup;
} }
var item = {type: "li", attributes: {"class": "listLink"}, children: [ { var item = {
type: "context", type: "li",
tiddler: tiddler, attributes: {
children: [] "class": "listLink"},
}]}; children: [ {
ul.children.push(item); type: "context",
var itemParseTree = this.parser.processor.textProcessors.parse(templateType,templateText); tiddler: tiddler,
for(var c=0; c<itemParseTree.children.length; c++) { children: []
item.children[0].children.push(itemParseTree.children[c]); }]};
ul.children.push(item);
var itemParseTree = this.parser.processor.textProcessors.parse(templateType,templateText);
for(var c=0; c<itemParseTree.children.length; c++) {
item.children[0].children.push(itemParseTree.children[c]);
}
} }
} }
this.executeMacros(macroNode.output,title); this.executeMacros(macroNode.output,title);

View File

@ -1,4 +1,5 @@
title: ThisIsAlpha title: ThisIsAlpha
modifier: JeremyRuston modifier: JeremyRuston
modified: 20110228143927
TiddlyWiki5 is currently at //alpha status//, which means that it is still evolving, and not yet ready to be relied upon. But it also means that you can influence its development - join the [[Community]] and find out how you can help. TiddlyWiki5 is currently at //alpha status//, which means that it is still evolving, and not yet ready to be relied upon. But it also means that you can influence its development - join the [[Community]] and find out how you can help.