diff --git a/core/modules/wiki.js b/core/modules/wiki.js index cca58c2c1..15d6c5545 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -170,6 +170,18 @@ exports.tiddlerExists = function(title) { return !!this.tiddlers[title]; }; +/* +Generate an unused title from the specified base +*/ +exports.generateNewTitle = function(baseTitle) { + var c = 0; + do { + var title = baseTitle + (c ? " " + (c + 1) : ""); + c++; + } while(this.tiddlerExists(title)); + return title; +}; + exports.isSystemTiddler = function(title) { return title.indexOf("$:/") === 0; }; @@ -920,4 +932,63 @@ exports.getTiddlerText = function(title,defaultText) { } }; +/* +Read an array of browser File objects, invoking callback(tiddlerFields) for each loaded file +*/ +exports.readFiles = function(files,callback) { + for(var f=0; f