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