mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 12:07:19 +00:00
Process DefaultTiddlers on the server as well as the browser
Thus fixing the baking of static.html
This commit is contained in:
parent
83900b0230
commit
32331a8764
@ -32,6 +32,20 @@ exports.startup = function() {
|
||||
$tw.wiki.initServerConnections();
|
||||
// Set up the command modules
|
||||
$tw.Commander.initCommands();
|
||||
// Get the default tiddlers
|
||||
var defaultTiddlersTitle = "$:/DefaultTiddlers",
|
||||
defaultTiddlersTiddler = $tw.wiki.getTiddler(defaultTiddlersTitle),
|
||||
defaultTiddlers = [];
|
||||
if(defaultTiddlersTiddler) {
|
||||
defaultTiddlers = $tw.wiki.filterTiddlers(defaultTiddlersTiddler.fields.text);
|
||||
}
|
||||
// Initialise the story and history
|
||||
var storyTitle = "$:/StoryList",
|
||||
story = [];
|
||||
for(var t=0; t<defaultTiddlers.length; t++) {
|
||||
story[t] = defaultTiddlers[t];
|
||||
}
|
||||
$tw.wiki.addTiddler({title: storyTitle, text: story.join("\n")});
|
||||
// Host-specific startup
|
||||
if($tw.browser) {
|
||||
// Call browser startup modules
|
||||
@ -80,20 +94,6 @@ exports.startup = function() {
|
||||
styleNode.appendChild(document.createTextNode(renderTree.render("text/plain")));
|
||||
document.getElementsByTagName("head")[0].appendChild(styleNode);
|
||||
});
|
||||
// Get the default tiddlers
|
||||
var defaultTiddlersTitle = "$:/DefaultTiddlers",
|
||||
defaultTiddlersTiddler = $tw.wiki.getTiddler(defaultTiddlersTitle),
|
||||
defaultTiddlers = [];
|
||||
if(defaultTiddlersTiddler) {
|
||||
defaultTiddlers = $tw.wiki.filterTiddlers(defaultTiddlersTiddler.fields.text);
|
||||
}
|
||||
// Initialise the story and history
|
||||
var storyTitle = "$:/StoryList",
|
||||
story = [];
|
||||
for(var t=0; t<defaultTiddlers.length; t++) {
|
||||
story[t] = defaultTiddlers[t];
|
||||
}
|
||||
$tw.wiki.addTiddler({title: storyTitle, text: story.join("\n")});
|
||||
// If we're being viewed on a data: URI then give instructions for how to save
|
||||
if(document.location.protocol === "data:") {
|
||||
var event = document.createEvent("Event");
|
||||
|
Loading…
Reference in New Issue
Block a user