2012-01-12 21:48:24 +00:00
|
|
|
/*\
|
|
|
|
title: js/BitmapParser.js
|
|
|
|
|
|
|
|
Compiles bitmap images into JavaScript functions that render them in HTML
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
// The parse tree is degenerate
|
|
|
|
var BitmapParseTree = function() {
|
|
|
|
this.dependencies = [];
|
|
|
|
};
|
|
|
|
|
|
|
|
BitmapParseTree.prototype.compile = function(type) {
|
|
|
|
if(type === "text/html") {
|
2012-01-17 13:01:55 +00:00
|
|
|
return "(function (tiddler,store,utils) {return '<img src=\"data:' + tiddler.type + ';base64,' + tiddler.text + '\">';})";
|
2012-01-12 21:48:24 +00:00
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var BitmapParser = function() {
|
|
|
|
};
|
|
|
|
|
|
|
|
BitmapParser.prototype.parse = function() {
|
|
|
|
return new BitmapParseTree();
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.BitmapParser = BitmapParser;
|
|
|
|
|
|
|
|
})();
|