1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-28 02:50:27 +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],
theGroupParseTree = this.parser.processor.textProcessors.parse(groupTemplateType,groupTemplateText),
theGroup = theGroupParseTree.render("text/plain",theGroupParseTree.children,this.store,tiddler);
if(ul === undefined || theGroup != lastGroup) {
ul = {type: "ul", attributes: {"class": "timeline"}, children: []};
macroNode.output.push(ul);
ul.children.push({type: "li", attributes: {"class": "listTitle"}, children: [{type: "text", value: theGroup}]});
lastGroup = theGroup;
}
var item = {type: "li", attributes: {"class": "listLink"}, children: [ {
type: "context",
tiddler: tiddler,
children: []
}]};
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]);
if(theGroup !== "") {
if(ul === undefined || theGroup != lastGroup) {
ul = {type: "ul", attributes: {"class": "timeline"}, children: []};
macroNode.output.push(ul);
ul.children.push({type: "li", attributes: {"class": "listTitle"}, children: [{type: "text", value: theGroup}]});
lastGroup = theGroup;
}
var item = {
type: "li",
attributes: {
"class": "listLink"},
children: [ {
type: "context",
tiddler: tiddler,
children: []
}]};
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);

View File

@ -1,4 +1,5 @@
title: ThisIsAlpha
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.