1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-28 15:08:46 +00:00

Added support for list all macro

This commit is contained in:
Jeremy Ruston 2011-12-14 18:25:40 +00:00
parent d96053192b
commit 50e11a0da8
11 changed files with 76 additions and 5 deletions

View File

@ -90,5 +90,6 @@ navigators.install("a","StoryNavigator");
// Navigate to HelloThere
navigators.navigateTo("HelloThere","StoryNavigator");
navigators.navigateTo("TabAll","StoryNavigator");
})();

View File

@ -88,6 +88,14 @@ WikiStore.prototype.forEachTiddler = function(/* [sortField,[excludeTag,]]callba
}
};
WikiStore.prototype.getTitles = function(sortField,excludeTag) {
var tiddlers = [];
this.forEachTiddler(sortField,excludeTag,function(title,tiddler) {
tiddlers.push(title);
});
return tiddlers;
};
WikiStore.prototype.parseTiddler = function(title) {
var tiddler = this.getTiddler(title);
if(tiddler) {

View File

@ -140,10 +140,61 @@ WikiTextRenderer.macros = {
},
br: {
handler: function(macroNode) {
macroNode.output.push({type: "br"});
}
},
list: {
handler: function(macroNode) {
var args = new ArgParser(macroNode.params,{defaultName:"type"}),
type = args.getValueByName("type","all"),
template = args.getValueByName("template",null),
emptyMessage = args.getValueByName("emptyMessage",null);
// Get the template to use (currently it's ignored though)
template = template ? this.store.getTiddlerText(template,null) : null;
template = template || "<<view title link>>";
// Get the tiddlers
var handler = WikiTextRenderer.macros.list.types[type];
handler = handler || WikiTextRenderer.macros.list.types.all;
var tiddlers = handler.call(this);
// Render them as a list
var ul = {type: "ul", children: []};
for(var t=0; t<tiddlers.length; t++) {
var title = tiddlers[t],
li = {
type: "li",
children: [ {
type: "a",
attributes: {
href: title},
children: [ {
type: "text", value: title
}]}
]};
ul.children.push(li);
}
macroNode.output.push(ul);
},
types: {
all: function() {
return this.store.getTitles("title","excludeLists");
},
missing: function() {
return this.store.getMissingTitles();
},
orphans: function() {
return this.store.getOrphanTitles();
},
shadowed: function() {
return this.store.getShadowTitles();
},
touched: function() {
// Server syncing isn't implemented yet
return [];
},
filter: function() {
// Filters aren't implemented yet
return [];
}
}
},
slider: {

View File

@ -8,7 +8,7 @@ mkdir -p tmp/newcooked
node tiddlywiki.js --recipe $PWD/test/tiddlywiki.2.6.5/source/tiddlywiki.com/index.html.recipe --savewiki tmp/newcooked || exit 1
# compare the two
opendiff tmp/newcooked/index.html test/tiddlywiki.2.6.5/target/index.2.6.5.html
diff tmp/newcooked/index.html test/tiddlywiki.2.6.5/target/index.2.6.5.html
# Run the wikification tests
node wikitest.js test/wikitests/

View File

@ -1 +1 @@
<table className="twtable"><caption align="top">A caption above the table</caption><thead><tr className="evenRow"><td align="center">Left</td><td align="center">Middle</td><td align="center">Right</td></tr></thead><tbody><tr className="oddRow"><td>North West</td><td>North</td><td>North East</td></tr><tr className="evenRow"><td>West</td><td>Here</td><td>East</td></tr><tr className="oddRow"><td>South West</td><td>South</td><td>South East</td></tr></tbody></table>
<table class="twtable"><caption align="top">A caption above the table</caption><thead><tr class="evenRow"><td align="center">Left</td><td align="center">Middle</td><td align="center">Right</td></tr></thead><tbody><tr class="oddRow"><td>North West</td><td>North</td><td>North East</td></tr><tr class="evenRow"><td>West</td><td>Here</td><td>East</td></tr><tr class="oddRow"><td>South West</td><td>South</td><td>South East</td></tr></tbody></table>

View File

@ -1 +1 @@
<h2>Heading</h2>This is the second tiddler. It has a list:<br /><ul><li> Item one</li><li> Item two</li><li> Item three</li></ul>And a macro invocation 2.6.5 and a <span className="myClass">custom class</span><br />
<h2>Heading</h2>This is the second tiddler. It has a list:<br /><ul><li> Item one</li><li> Item two</li><li> Item three</li></ul>And a macro invocation 2.6.5 and a <span class="myClass">custom class</span><br />

View File

@ -0,0 +1 @@
SixthTiddler<br /><a href="SixthTiddler">SixthTiddler</a><br />11 February 2011<br /><a href="Jermolene">Jermolene</a><br /><ul><li><a href="Fifth Tiddler">Fifth Tiddler</a></li><li><a href="FirstTiddler">FirstTiddler</a></li><li><a href="Fourth Tiddler">Fourth Tiddler</a></li><li><a href="SecondTiddler">SecondTiddler</a></li><li><a href="SixthTiddler">SixthTiddler</a></li><li><a href="ThirdTiddler">ThirdTiddler</a></li></ul><br />

View File

@ -0,0 +1,9 @@
title: SixthTiddler
modified: 20110211110621
modifier: Jermolene
<<view title>>
<<view title wikified>>
<<view modified date>>
<<view modifier link>>
<<list all>>

View File

@ -0,0 +1 @@
SixthTiddlerSixthTiddler11 February 2011JermoleneFifth TiddlerFirstTiddlerFourth TiddlerSecondTiddlerSixthTiddlerThirdTiddler

View File

@ -16,8 +16,6 @@ article {
font-weight: bold;
font-size: 62px;
line-height: 81px;
margin-top: 27px;
margin-bottom: 54px;
}
h1 {
font-size: 33px;

View File

@ -8,3 +8,5 @@ TiddlyWiki is a unique [[wiki|WikiWikiWeb]] that people [[love using|Raves]] to
TiddlyWiki is written in [[HTML]], [[CSS]] and JavaScript to run on any reasonably modern [[browser|Browsers]] without needing any ServerSide logic. It allows anyone to create personal SelfContained hypertext documents that can be published to a WebServer, sent by email, stored in a DropBox or kept on a USB thumb drive to make a WikiOnAStick. Because it doesn't need to be installed and configured it makes a great GuerillaWiki. This is revision <<version>> of TiddlyWiki, and is published under an OpenSourceLicense.
Unlike most wikis, TiddlyWiki doesn't directly support group collaboration; it is a wiki in the sense of elevating linking be a part of the punctuation of writing. You can easily publish a TiddlyWiki you have created by placing the single file on a web server (for instance the homepage hosting provided by many ISPs). If you need full group collaboration features, there are several HostedOptions to choose from.
<<list all>>