From 3994f0dbc6ad223bc2e0f87db62c3364f2b6f799 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 27 Feb 2014 16:30:05 +0000 Subject: [PATCH] Add new option to retain tiddler paths --- boot/boot.js | 10 +++++++++- .../tiddlers/concepts/TiddlyWikiFolders.tid | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/boot/boot.js b/boot/boot.js index eaad53776..1ee72ef68 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -1373,7 +1373,6 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) { // Load the wiki files, registering them as writable var resolvedWikiPath = path.resolve(wikiPath,$tw.config.wikiTiddlersSubDir); $tw.utils.each($tw.loadTiddlersFromPath(resolvedWikiPath),function(tiddlerFile) { - $tw.wiki.addTiddlers(tiddlerFile.tiddlers); if(tiddlerFile.filepath) { $tw.utils.each(tiddlerFile.tiddlers,function(tiddler) { $tw.boot.files[tiddler.title] = { @@ -1383,7 +1382,16 @@ $tw.loadWikiTiddlers = function(wikiPath,parentPaths) { }; }); } + $tw.wiki.addTiddlers(tiddlerFile.tiddlers); }); + // Save the original tiddler file locations if requested + if(wikiInfo.config && wikiInfo.config["retain-original-tiddler-path"]) { + var output = []; + for(var title in $tw.boot.files) { + output.push(title + ": " + path.relative(resolvedWikiPath,$tw.boot.files[title].filepath) + "\n"); + } + $tw.wiki.addTiddler({title: "$:/config/OriginalTiddlerPaths", type: "application/x-tiddler-dictionary", text: output.join("")}); + } // Save the path to the tiddlers folder for the filesystemadaptor $tw.boot.wikiTiddlersPath = path.resolve($tw.boot.wikiPath,$tw.config.wikiTiddlersSubDir); // Load any plugins within the wiki folder diff --git a/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid b/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid index 38bdd29ec..547fb6d7c 100644 --- a/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid +++ b/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid @@ -1,5 +1,5 @@ created: 20130825214200000 -modified: 20140206174804112 +modified: 20140227162920614 tags: dev title: TiddlyWikiFolders type: text/vnd.tiddlywiki @@ -21,7 +21,14 @@ Only the ''tiddlywiki.info'' file is required, the ''tiddlers'' and ''plugins'' The `tiddlywiki.info` file in a wiki folder contains a JSON object comprising the following fields: * ''plugins'' - an array of plugin names to be included in the wiki +* ''themes'' - an array of theme names to be included in the wiki +* ''languages'' - an array of language names to be included in the wiki * ''includeWikis'' - an array of relative paths to external wiki folders to be included in the wiki +* ''config'' - an optional hashmap of configuration options (see below) + +Configuration options include: + +* ''retain-original-tiddler-path'' - If true, the server will generate a tiddler [[$:/config/OriginalTiddlerPaths]] containing the original file paths of each tiddler in the wiki For example: @@ -33,7 +40,10 @@ For example: ], "includeWikis": [ "../tw5.com" - ] + ], + "config": { + "retain-original-tiddler-path": true + } } ```