mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-04 13:19:11 +00:00
Make the core into a plugin
This commit is contained in:
parent
c411ee5106
commit
cd36f594c5
@ -599,7 +599,7 @@ $tw.Wiki.prototype.definePluginModules = function() {
|
|||||||
$tw.utils.each(this.shadowTiddlers,function(element,title,object) {
|
$tw.utils.each(this.shadowTiddlers,function(element,title,object) {
|
||||||
var tiddler = self.getTiddler(title);
|
var tiddler = self.getTiddler(title);
|
||||||
if(!$tw.utils.hop(self.tiddlers,title)) { // Don't define the module if it is overidden by an ordinary tiddler
|
if(!$tw.utils.hop(self.tiddlers,title)) { // Don't define the module if it is overidden by an ordinary tiddler
|
||||||
if(tiddler.fields.type === "application/javascript" && tiddler.hasField("module-type")) {
|
if(tiddler.hasField("module-type")) {
|
||||||
// Define the module
|
// Define the module
|
||||||
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],tiddler.fields.text);
|
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],tiddler.fields.text);
|
||||||
}
|
}
|
||||||
@ -1035,7 +1035,7 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
|
|||||||
}
|
}
|
||||||
// Load any plugins listed in the wiki info file
|
// Load any plugins listed in the wiki info file
|
||||||
if(wikiInfo.plugins) {
|
if(wikiInfo.plugins) {
|
||||||
var pluginBasePath = path.resolve($tw.boot.bootPath,$tw.config.pluginsPath);
|
var pluginBasePath = path.resolve($tw.boot.corePath,$tw.config.pluginsPath);
|
||||||
for(var t=0; t<wikiInfo.plugins.length; t++) {
|
for(var t=0; t<wikiInfo.plugins.length; t++) {
|
||||||
pluginFields = $tw.loadPluginFolder(path.resolve(pluginBasePath,"./" + wikiInfo.plugins[t]));
|
pluginFields = $tw.loadPluginFolder(path.resolve(pluginBasePath,"./" + wikiInfo.plugins[t]));
|
||||||
if(pluginFields) {
|
if(pluginFields) {
|
||||||
@ -1072,10 +1072,12 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$tw.loadTiddlers = function() {
|
$tw.loadTiddlers = function() {
|
||||||
// Load the core tiddlers
|
// Load the boot tiddlers
|
||||||
$tw.utils.each($tw.loadTiddlersFromPath($tw.boot.bootPath),function(tiddlerFile) {
|
$tw.utils.each($tw.loadTiddlersFromPath($tw.boot.bootPath),function(tiddlerFile) {
|
||||||
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
||||||
});
|
});
|
||||||
|
// Load the core tiddlers
|
||||||
|
$tw.wiki.addTiddler($tw.loadPluginFolder($tw.boot.corePath));
|
||||||
// Load the tiddlers from the wiki directory
|
// Load the tiddlers from the wiki directory
|
||||||
$tw.boot.wikiInfo = $tw.loadWikiTiddlers($tw.boot.wikiPath);
|
$tw.boot.wikiInfo = $tw.loadWikiTiddlers($tw.boot.wikiPath);
|
||||||
};
|
};
|
||||||
@ -1107,6 +1109,7 @@ $tw.boot.startup = function() {
|
|||||||
$tw.boot.files = {};
|
$tw.boot.files = {};
|
||||||
// System paths and filenames
|
// System paths and filenames
|
||||||
$tw.boot.bootPath = path.dirname(module.filename);
|
$tw.boot.bootPath = path.dirname(module.filename);
|
||||||
|
$tw.boot.corePath = path.resolve($tw.boot.bootPath,"../core");
|
||||||
// If the first command line argument doesn't start with `--` then we
|
// If the first command line argument doesn't start with `--` then we
|
||||||
// interpret it as the path to the wiki folder, which will otherwise default
|
// interpret it as the path to the wiki folder, which will otherwise default
|
||||||
// to the current folder
|
// to the current folder
|
||||||
@ -1119,7 +1122,7 @@ $tw.boot.startup = function() {
|
|||||||
}
|
}
|
||||||
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,$tw.config.wikiTiddlersSubDir);
|
$tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,$tw.config.wikiTiddlersSubDir);
|
||||||
// Read package info
|
// Read package info
|
||||||
$tw.packageInfo = JSON.parse(fs.readFileSync($tw.boot.bootPath + "/../package.json"));
|
$tw.packageInfo = JSON.parse(fs.readFileSync($tw.boot.corePath + "/../package.json"));
|
||||||
// Check node version number
|
// Check node version number
|
||||||
if($tw.utils.checkVersions($tw.packageInfo.engines.node.substr(2),process.version.substr(1))) {
|
if($tw.utils.checkVersions($tw.packageInfo.engines.node.substr(2),process.version.substr(1))) {
|
||||||
$tw.utils.error("TiddlyWiki5 requires node.js version " + $tw.packageInfo.engine.node);
|
$tw.utils.error("TiddlyWiki5 requires node.js version " + $tw.packageInfo.engine.node);
|
@ -90,8 +90,7 @@ exports.startup = function() {
|
|||||||
$tw.crypto.setPassword(null);
|
$tw.crypto.setPassword(null);
|
||||||
});
|
});
|
||||||
// Apply stylesheets
|
// Apply stylesheets
|
||||||
var styleTiddlers = $tw.wiki.getTiddlersWithTag("$:/core/styles");
|
$tw.utils.each($tw.modules.types.stylesheet,function(moduleInfo,title) {
|
||||||
$tw.utils.each(styleTiddlers,function(title) {
|
|
||||||
// Stylesheets don't refresh, yet
|
// Stylesheets don't refresh, yet
|
||||||
var parser = $tw.wiki.parseTiddler(title),
|
var parser = $tw.wiki.parseTiddler(title),
|
||||||
renderTree = new $tw.WikiRenderTree(parser,{wiki: $tw.wiki});
|
renderTree = new $tw.WikiRenderTree(parser,{wiki: $tw.wiki});
|
||||||
|
@ -375,7 +375,7 @@ application/x-tiddler-dictionary: the tiddler is parsed as sequence of name:valu
|
|||||||
Other types currently just return null.
|
Other types currently just return null.
|
||||||
*/
|
*/
|
||||||
exports.getTiddlerData = function(title,defaultData) {
|
exports.getTiddlerData = function(title,defaultData) {
|
||||||
var tiddler = this.tiddlers[title],
|
var tiddler = this.getTiddler(title),
|
||||||
data;
|
data;
|
||||||
if(tiddler && tiddler.fields.text) {
|
if(tiddler && tiddler.fields.text) {
|
||||||
switch(tiddler.fields.type) {
|
switch(tiddler.fields.type) {
|
||||||
|
7
core/plugin.info
Normal file
7
core/plugin.info
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"title": "$:",
|
||||||
|
"description": "TiddlyWiki5 core plugin",
|
||||||
|
"author": "JeremyRuston",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"coreVersion": ">=5.0.0"
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
title: $:/core/styles/base
|
title: $:/core/styles/base
|
||||||
tags: $:/core/styles
|
module-type: stylesheet
|
||||||
|
|
||||||
\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline
|
\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline
|
||||||
\define border-radius(radius)
|
\define border-radius(radius)
|
||||||
|
@ -4,4 +4,4 @@
|
|||||||
This is invoked as a shell script by NPM when the `tiddlywiki` command is typed
|
This is invoked as a shell script by NPM when the `tiddlywiki` command is typed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var tiddlywiki = require("./core/boot.js");
|
var tiddlywiki = require("./boot/boot.js");
|
||||||
|
Loading…
Reference in New Issue
Block a user