Add support for preloading plugins by path instead of name

fix-syncer
Jeremy Ruston 2019-05-24 12:06:11 +01:00
rodzic 2f8053265e
commit feab75a6d1
2 zmienionych plików z 15 dodań i 7 usunięć

Wyświetl plik

@ -2044,10 +2044,17 @@ $tw.loadTiddlersNode = function() {
$tw.wiki.addTiddler($tw.loadPluginFolder($tw.boot.corePath));
// Load any extra plugins
$tw.utils.each($tw.boot.extraPlugins,function(name) {
var parts = name.split("/"),
type = parts[0];
if(parts.length === 3 && ["plugins","themes","languages"].indexOf(type) !== -1) {
$tw.loadPlugins([parts[1] + "/" + parts[2]],$tw.config[type + "Path"],$tw.config[type + "EnvVar"]);
if(name.charAt(0) === "+") { // Relative path to plugin
var pluginFields = $tw.loadPluginFolder(name.substring(1));;
if(pluginFields) {
$tw.wiki.addTiddler(pluginFields);
}
} else {
var parts = name.split("/"),
type = parts[0];
if(parts.length === 3 && ["plugins","themes","languages"].indexOf(type) !== -1) {
$tw.loadPlugins([parts[1] + "/" + parts[2]],$tw.config[type + "Path"],$tw.config[type + "EnvVar"]);
}
}
});
// Load the tiddlers from the wiki directory

Wyświetl plik

@ -1,5 +1,5 @@
created: 20131219100520659
modified: 20190412170813209
modified: $tw.loadPluginFolder(name.substring(1));
tags: [[TiddlyWiki on Node.js]]
title: Using TiddlyWiki on Node.js
type: text/vnd.tiddlywiki
@ -14,14 +14,14 @@ tiddlywiki --verbose --load mywiki.html --rendertiddler ReadMe ./readme.html
Running `tiddlywiki` from the command line boots the TiddlyWiki kernel, loads the core plugins and establishes an empty wiki store. It then sequentially processes the command line arguments from left to right. The arguments are separated with spaces.
<<.from-version "5.1.20">> First, there can be zero or more plugin references identified by the prefix `+`. These plugins are loaded in addition to any specified in the [[TiddlyWikiFolder|TiddlyWikiFolders]].
<<.from-version "5.1.20">> First, there can be zero or more plugin references identified by the prefix `+` for plugin names or `++` for a path to a plugin folder. These plugins are loaded in addition to any specified in the [[TiddlyWikiFolder|TiddlyWikiFolders]].
The next argument is the optional path to the [[TiddlyWikiFolder|TiddlyWikiFolders]] to be loaded. If not present, then the current directory is used.
The commands and their individual arguments follow, each command being identified by the prefix `--`.
```
tiddlywiki [+<pluginname>] [<wikipath>] [--<command> [<arg>[,<arg>]]]
tiddlywiki [+<pluginname> | ++<pluginpath>] [<wikipath>] [--<command> [<arg>[,<arg>]]]
```
For example:
@ -29,6 +29,7 @@ For example:
```
tiddlywiki --version
tiddlywiki +plugins/tiddlywiki/filesystem +plugins/tiddlywiki/tiddlyweb mywiki --listen
tiddlywiki ++./mygreatplugin mywiki --listen
```
<<.from-version "5.1.18">> Commands such as the ListenCommand that support large numbers of parameters can use NamedCommandParameters to make things less unwieldy. For example: