kopia lustrzana https://github.com/miklobit/TiddlyWiki5
rodzic
f5c56c066e
commit
510006d67d
|
@ -91,6 +91,7 @@ var App = function() {
|
||||||
this.store.installMacro(require("./macros/echo.js").macro);
|
this.store.installMacro(require("./macros/echo.js").macro);
|
||||||
this.store.installMacro(require("./macros/info.js").macro);
|
this.store.installMacro(require("./macros/info.js").macro);
|
||||||
this.store.installMacro(require("./macros/list.js").macro);
|
this.store.installMacro(require("./macros/list.js").macro);
|
||||||
|
this.store.installMacro(require("./macros/story.js").macro);
|
||||||
this.store.installMacro(require("./macros/tiddler.js").macro);
|
this.store.installMacro(require("./macros/tiddler.js").macro);
|
||||||
this.store.installMacro(require("./macros/version.js").macro);
|
this.store.installMacro(require("./macros/version.js").macro);
|
||||||
this.store.installMacro(require("./macros/view.js").macro);
|
this.store.installMacro(require("./macros/view.js").macro);
|
||||||
|
@ -104,8 +105,9 @@ var App = function() {
|
||||||
navigators.registerNavigator("StoryNavigator",new StoryNavigator(navigators));
|
navigators.registerNavigator("StoryNavigator",new StoryNavigator(navigators));
|
||||||
// Use the story navigator for all links
|
// Use the story navigator for all links
|
||||||
navigators.install("a","StoryNavigator");
|
navigators.install("a","StoryNavigator");
|
||||||
// Navigate to HelloThere
|
// Open the PageTemplate
|
||||||
navigators.navigateTo("HelloThere","StoryNavigator");
|
var div = $("<div/>").html(this.store.renderTiddler("text/html","PageTemplate"));
|
||||||
|
div.appendTo("body");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*\
|
||||||
|
title: js/macros/story.js
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var utils = require("../Utils.js");
|
||||||
|
|
||||||
|
exports.macro = {
|
||||||
|
name: "story",
|
||||||
|
types: ["text/html","text/plain"],
|
||||||
|
params: {
|
||||||
|
story: {byName: "default", type: "text", optional: false},
|
||||||
|
template: {byName: true, type: "text", optional: true}
|
||||||
|
},
|
||||||
|
code: function(type,tiddler,store,params) {
|
||||||
|
var templateType = "text/x-tiddlywiki",
|
||||||
|
templateText = "<<view text wikified>>",
|
||||||
|
template = params.template ? store.getTiddler(params.template) : null,
|
||||||
|
tiddlers = store.getTiddlerText(params.story).split("\n"),
|
||||||
|
t,
|
||||||
|
output = [];
|
||||||
|
if(template) {
|
||||||
|
templateType = template.fields.type;
|
||||||
|
templateText = template.fields.text;
|
||||||
|
}
|
||||||
|
for(t=0; t<tiddlers.length; t++) {
|
||||||
|
var title = tiddlers[t].trim();
|
||||||
|
if(title !== "") {
|
||||||
|
output.push("<article>");
|
||||||
|
output.push(store.renderText(templateType,templateText,"text/html",title));
|
||||||
|
output.push("</article>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return output.join("\n");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
title: Motovun Jack.jpg
|
title: Motovun Jack.jpg
|
||||||
type: image/jpg
|
type: image/jpeg
|
||||||
source: http://www.flickr.com/photos/jermy/6292279493/in/photostream
|
source: http://www.flickr.com/photos/jermy/6292279493/in/photostream
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
title: PageTemplate
|
||||||
|
|
||||||
|
<<story story:StoryTiddlers template:SimpleTemplate>>
|
|
@ -0,0 +1,5 @@
|
||||||
|
title: StoryTiddlers
|
||||||
|
|
||||||
|
HelloThere
|
||||||
|
ThisIsAlpha
|
||||||
|
NewWikiTextFeatures
|
|
@ -13,3 +13,6 @@ tiddler: SiteTitle.tid
|
||||||
tiddler: SiteSubtitle.tid
|
tiddler: SiteSubtitle.tid
|
||||||
|
|
||||||
tiddler: SimpleTemplate.tid
|
tiddler: SimpleTemplate.tid
|
||||||
|
|
||||||
|
tiddler: PageTemplate.tid
|
||||||
|
tiddler: StoryTiddlers.tid
|
||||||
|
|
|
@ -6,7 +6,7 @@ recipe: tiddlers/split.recipe
|
||||||
recipe: ../parsers/split.recipe
|
recipe: ../parsers/split.recipe
|
||||||
tiddler: ../docs/High Level Architecture.svg
|
tiddler: ../docs/High Level Architecture.svg
|
||||||
tiddler: http://wikitext.tiddlyspace.com/fractalveg.jpg
|
tiddler: http://wikitext.tiddlyspace.com/fractalveg.jpg
|
||||||
type: image/jpg
|
type: image/jpeg
|
||||||
|
|
||||||
jslib: ../test/tiddlywiki.2.6.5/source/tiddlywiki/jquery/jquery.js
|
jslib: ../test/tiddlywiki.2.6.5/source/tiddlywiki/jquery/jquery.js
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ jsmodule: ../js/App.js
|
||||||
jsmodule: ../js/macros/echo.js
|
jsmodule: ../js/macros/echo.js
|
||||||
jsmodule: ../js/macros/info.js
|
jsmodule: ../js/macros/info.js
|
||||||
jsmodule: ../js/macros/list.js
|
jsmodule: ../js/macros/list.js
|
||||||
|
jsmodule: ../js/macros/story.js
|
||||||
jsmodule: ../js/macros/tiddler.js
|
jsmodule: ../js/macros/tiddler.js
|
||||||
jsmodule: ../js/macros/version.js
|
jsmodule: ../js/macros/version.js
|
||||||
jsmodule: ../js/macros/view.js
|
jsmodule: ../js/macros/view.js
|
||||||
|
|
Ładowanie…
Reference in New Issue