Enhance "includeWikis" to merge build targets

Build targets found in included wikis are merged behind any found in
the wiki itself
This commit is contained in:
Jermolene 2014-10-14 15:14:50 +01:00
parent 2d25c40227
commit 49dc5694a3
2 changed files with 6 additions and 2 deletions

View File

@ -1583,7 +1583,9 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) {
$tw.utils.each(wikiInfo.includeWikis,function(includedWikiPath) {
var resolvedIncludedWikiPath = path.resolve(wikiPath,includedWikiPath);
if(parentPaths.indexOf(resolvedIncludedWikiPath) === -1) {
$tw.loadWikiTiddlers(resolvedIncludedWikiPath,parentPaths);
var subWikiInfo = $tw.loadWikiTiddlers(resolvedIncludedWikiPath,parentPaths);
// Merge the build targets
wikiInfo.build = $tw.utils.extend([],subWikiInfo.build,wikiInfo.build);
} else {
$tw.utils.error("Cannot recursively include wiki " + resolvedIncludedWikiPath);
}

View File

@ -1,5 +1,5 @@
created: 20130825214200000
modified: 20140912141727308
modified: 20141013204930183
tags: [[TiddlyWiki on Node.js]]
title: TiddlyWikiFolders
type: text/vnd.tiddlywiki
@ -27,6 +27,8 @@ The `tiddlywiki.info` file in a wiki folder contains a JSON object comprising th
* ''build'' - a hashmap of named build targets, each defined by an array of command tokens (see BuildCommand)
* ''config'' - an optional hashmap of configuration options (see below)
Note that the build targets of included wikis are merged if a target of that name isn't defined in the current `tiddlywiki.info` file.
Configuration options include:
* ''default-tiddler-location'' - a string path to the default location for the filesystem adaptor to save new tiddlers (resolved relative to the wiki folder)