kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Added serializers required for cooking TiddlyWiki documents
rodzic
e3524942cc
commit
bf8100201d
|
@ -21,4 +21,28 @@ exports["text/html"] = function(tiddler) {
|
|||
return text ? text : "";
|
||||
};
|
||||
|
||||
exports["application/x-tiddler-module"] = function(tiddler) {
|
||||
var result = [];
|
||||
result.push("<" + "script type=\"text/javascript\" data-tiddler-title=\"" + tiddler.fields.title + "\">");
|
||||
result.push("$tw.modules.define(\"" + tiddler.fields.title + "\",\"" + tiddler.fields["module-type"] + "\",function(module,exports,require) {");
|
||||
result.push(tiddler.fields.text);
|
||||
result.push("});");
|
||||
result.push("</" + "script>\n");
|
||||
return result.join("");
|
||||
};
|
||||
|
||||
exports["application/x-tiddler-html-div"] = function(tiddler) {
|
||||
var result = [];
|
||||
result.push("<div");
|
||||
for(var f in tiddler.fields) {
|
||||
if(f !== "text") {
|
||||
result.push(" " + f + "=\"" + tiddler.getFieldString(f) + "\"");
|
||||
}
|
||||
}
|
||||
result.push(">\n<pre>");
|
||||
result.push($tw.utils.htmlEncode(tiddler.fields.text));
|
||||
result.push("</pre>\n</div>");
|
||||
return result.join("");
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
Ładowanie…
Reference in New Issue