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:
Jeremy Ruston 2013-04-28 09:42:48 +01:00
parent d62c9f613c
commit 31a378b64c
13 changed files with 36 additions and 0 deletions

View File

@ -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
var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir);
$tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) {
@ -1139,6 +1149,7 @@ $tw.boot.startup = function() {
},
config: { // Configuration overridables
pluginsPath: "../plugins/",
themesPath: "../themes/",
wikiInfo: "./tiddlywiki.info",
wikiPluginsSubDir: "./plugins",
wikiTiddlersSubDir: "./tiddlers",

View File

@ -3,6 +3,9 @@
"tiddlywiki/tiddlyweb",
"tiddlywiki/filesystem"
],
"themes": [
"tiddlywiki/snowwhite"
],
"doNotSave": [
"$:/StoryList",
"$:/HistoryList",

View File

@ -1,5 +1,8 @@
{
"plugins": [
"tiddlywiki/fullscreen"
],
"themes": [
"tiddlywiki/snowwhite"
]
}

View File

@ -1,5 +1,8 @@
{
"plugins": [
"tiddlywiki/tahoelafs"
],
"themes": [
"tiddlywiki/snowwhite"
]
}

View File

@ -1,5 +1,8 @@
{
"plugins": [
"tiddlywiki/jasmine"
],
"themes": [
"tiddlywiki/snowwhite"
]
}

View File

@ -1,5 +1,8 @@
{
"plugins": [
"tiddlywiki/fullscreen"
],
"themes": [
"tiddlywiki/snowwhite"
]
}

View File

@ -2,5 +2,8 @@
"plugins": [
"tiddlywiki/fullscreen",
"tiddlywiki/tiddlyweb"
],
"themes": [
"tiddlywiki/snowwhite"
]
}

View File

@ -0,0 +1,7 @@
{
"title": "$:/themes/tiddlywiki/snowwhite",
"description": "A simple, plain layout",
"author": "JeremyRuston",
"version": "0.0.0",
"coreVersion": ">=5.0.0"
}