1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-15 16:34:23 +00:00
TiddlyWiki5/js/TextProcessors.js
Jeremy Ruston 8ed8772b82 Experimental support for client-side builds
These changes allow tiddlywiki.js to cook it's own components into a
skeletal new-school client-side TiddlyWiki.
2011-12-13 12:30:09 +00:00

35 lines
592 B
JavaScript

/*\
title: js/TextProcessors.js
\*/
(function(){
/*jslint node: true */
"use strict";
var util = require("util");
var TextProcessors = function() {
this.processors = {};
};
TextProcessors.prototype.registerTextProcessor = function(type,processor) {
this.processors[type] = processor;
};
TextProcessors.prototype.parse = function(type,text) {
var processor = this.processors[type];
if(!processor) {
processor = this.processors["text/x-tiddlywiki"];
}
if(processor) {
return processor.parse(text);
} else {
return null;
}
};
exports.TextProcessors = TextProcessors;
})();