/*\ title: js/TiddlerOutput.js Functions concerned with parsing representations of tiddlers \*/ (function(){ /*jslint node: true */ "use strict"; var utils = require("./Utils.js"), util = require("util"); var tiddlerOutput = exports; // Utility function to convert a tags string array into a TiddlyWiki-style quoted tags string var stringifyTags = function(tags) { var results = []; for(var t=0; t out - array to push the output strings tid - the tiddler to be output The fields are in the order title, creator, modifier, created, modified, tags, followed by any others */ var outputTiddlerDiv = function(tid) { var result = [], attributes = {}, outputAttribute = function(name,transform,dontDelete) { if(name in attributes) { var value = attributes[name]; if(transform) value = transform(value); result.push(" " + name + "=\"" + value + "\""); if(!dontDelete) { delete attributes[name]; } } }; for(var t in tid.fields) { attributes[t] = tid.fields[t]; } if(attributes.text) { delete attributes.text; } result.push("\n
");
	result.push(utils.htmlEncode(tid.fields.text));
	result.push("
\n"); return result.join(""); }; tiddlerOutput.register = function(store) { store.registerTiddlerSerializer(".tid","application/x-tiddler",outputTiddler); store.registerTiddlerSerializer(".tiddler","application/x-tiddler-html-div",outputTiddlerDiv); }; })();