Start support for themes
To start with, we move the current stylesheets into a theme plugin called "Snow White". Wikis have to specify at least one theme in their `tiddlywiki.info` file. Next we'll add a mechanism for switching between loaded themes
This commit is contained in:
parent
d62c9f613c
commit
31a378b64c
11
boot/boot.js
11
boot/boot.js
|
@ -1086,6 +1086,16 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Load any themes listed in the wiki info file
|
||||||
|
if(wikiInfo.themes) {
|
||||||
|
var themesBasePath = path.resolve($tw.boot.corePath,$tw.config.themesPath);
|
||||||
|
for(var t=0; t<wikiInfo.themes.length; t++) {
|
||||||
|
pluginFields = $tw.loadPluginFolder(path.resolve(themesBasePath,"./" + wikiInfo.themes[t]));
|
||||||
|
if(pluginFields) {
|
||||||
|
$tw.wiki.addTiddler(pluginFields);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Load the wiki files, registering them as writable
|
// Load the wiki files, registering them as writable
|
||||||
var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir);
|
var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir);
|
||||||
$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) {
|
$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) {
|
||||||
|
@ -1139,6 +1149,7 @@ $tw.boot.startup = function() {
|
||||||
},
|
},
|
||||||
config: { // Configuration overridables
|
config: { // Configuration overridables
|
||||||
pluginsPath: "../plugins/",
|
pluginsPath: "../plugins/",
|
||||||
|
themesPath: "../themes/",
|
||||||
wikiInfo: "./tiddlywiki.info",
|
wikiInfo: "./tiddlywiki.info",
|
||||||
wikiPluginsSubDir: "./plugins",
|
wikiPluginsSubDir: "./plugins",
|
||||||
wikiTiddlersSubDir: "./tiddlers",
|
wikiTiddlersSubDir: "./tiddlers",
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
"tiddlywiki/tiddlyweb",
|
"tiddlywiki/tiddlyweb",
|
||||||
"tiddlywiki/filesystem"
|
"tiddlywiki/filesystem"
|
||||||
],
|
],
|
||||||
|
"themes": [
|
||||||
|
"tiddlywiki/snowwhite"
|
||||||
|
],
|
||||||
"doNotSave": [
|
"doNotSave": [
|
||||||
"$:/StoryList",
|
"$:/StoryList",
|
||||||
"$:/HistoryList",
|
"$:/HistoryList",
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/fullscreen"
|
"tiddlywiki/fullscreen"
|
||||||
|
],
|
||||||
|
"themes": [
|
||||||
|
"tiddlywiki/snowwhite"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/tahoelafs"
|
"tiddlywiki/tahoelafs"
|
||||||
|
],
|
||||||
|
"themes": [
|
||||||
|
"tiddlywiki/snowwhite"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/jasmine"
|
"tiddlywiki/jasmine"
|
||||||
|
],
|
||||||
|
"themes": [
|
||||||
|
"tiddlywiki/snowwhite"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/fullscreen"
|
"tiddlywiki/fullscreen"
|
||||||
|
],
|
||||||
|
"themes": [
|
||||||
|
"tiddlywiki/snowwhite"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -2,5 +2,8 @@
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"tiddlywiki/fullscreen",
|
"tiddlywiki/fullscreen",
|
||||||
"tiddlywiki/tiddlyweb"
|
"tiddlywiki/tiddlyweb"
|
||||||
|
],
|
||||||
|
"themes": [
|
||||||
|
"tiddlywiki/snowwhite"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"title": "$:/themes/tiddlywiki/snowwhite",
|
||||||
|
"description": "A simple, plain layout",
|
||||||
|
"author": "JeremyRuston",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"coreVersion": ">=5.0.0"
|
||||||
|
}
|
Loading…
Reference in New Issue