1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Added an option to specify default mime type in parseText()

This commit is contained in:
Jeremy Ruston 2012-03-03 18:07:33 +00:00
parent 588bc550c0
commit 4999a3b729

View File

@ -252,10 +252,17 @@ WikiStore.prototype.clearCache = function(title) {
} }
}; };
WikiStore.prototype.parseText = function(type,text) { /*
Parse a block of text of a specified MIME type
Options are:
defaultType: Default MIME type to use if the specified one is unknown
*/
WikiStore.prototype.parseText = function(type,text,options) {
options = options || {};
var parser = this.parsers[type]; var parser = this.parsers[type];
if(!parser) { if(!parser) {
parser = this.parsers["text/x-tiddlywiki"]; parser = this.parsers[options.defaultType || "text/x-tiddlywiki"];
} }
if(parser) { if(parser) {
return parser.parse(type,text); return parser.parse(type,text);