From 49dc5694a391a391264a4473e4f4422e2472a3b3 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Tue, 14 Oct 2014 15:14:50 +0100 Subject: [PATCH] Enhance "includeWikis" to merge build targets Build targets found in included wikis are merged behind any found in the wiki itself --- boot/boot.js | 4 +++- editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/boot/boot.js b/boot/boot.js index 2ac978d72..0748f5c86 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -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); } diff --git a/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid b/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid index 30baeef3d..d0e14d8ce 100644 --- a/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid +++ b/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid @@ -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)