From 631dd1cc5fb3805c5dc025921668d9a51d07a2aa Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 25 Mar 2013 19:50:33 +0000 Subject: [PATCH] Added ability to disable file saving for specific tiddlers --- editions/clientserver/tiddlywiki.info | 6 ++++++ plugins/tiddlywiki/filesystem/filesystemadaptor.js | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/editions/clientserver/tiddlywiki.info b/editions/clientserver/tiddlywiki.info index 42c5a0652..f224a8961 100644 --- a/editions/clientserver/tiddlywiki.info +++ b/editions/clientserver/tiddlywiki.info @@ -3,6 +3,12 @@ "tiddlywiki/tiddlyweb", "tiddlywiki/filesystem" ], + "doNotSave": [ + "$:/StoryList", + "$:/HistoryList", + "$:/status/IsLoggedIn", + "$:/status/UserName" + ], "includeWikis": [ "../tw5.com" ] diff --git a/plugins/tiddlywiki/filesystem/filesystemadaptor.js b/plugins/tiddlywiki/filesystem/filesystemadaptor.js index a8676afbd..0aee74eb3 100644 --- a/plugins/tiddlywiki/filesystem/filesystemadaptor.js +++ b/plugins/tiddlywiki/filesystem/filesystemadaptor.js @@ -101,7 +101,10 @@ FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback) { if(err) { return callback(err); } - if(fileInfo.hasMetaFile) { + if($tw.boot.wikiInfo.doNotSave && $tw.boot.wikiInfo.doNotSave.indexOf(tiddler.fields.title) !== -1) { + // Don't save the tiddler if it's on the blacklist + callback(null,{},0); + } else if(fileInfo.hasMetaFile) { // Save the tiddler as a separate body and meta file var typeInfo = $tw.config.contentTypeInfo[fileInfo.type]; fs.writeFile(fileInfo.filepath,tiddler.fields.text,{encoding: typeInfo.encoding},function(err) {