diff --git a/plugins/tiddlywiki/railroad/tw-parser.js b/plugins/tiddlywiki/railroad/tw-parser.js new file mode 100644 index 000000000..dd60fbdea --- /dev/null +++ b/plugins/tiddlywiki/railroad/tw-parser.js @@ -0,0 +1,28 @@ +/*\ +title: $:/plugins/tiddlywiki/railroad/tw-parser.js +type: application/javascript +module-type: parser + +This parser wraps unadorned railroad syntax into a railroad widget + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var RailroadParser = function(type,text,options) { + var element = { + type: "railroad", + tag: "$railroad", + text: text + }; + this.tree = [element]; +console.log(text); +}; + +exports["text/vnd.tiddlywiki.railroad"] = RailroadParser; + +})(); + diff --git a/plugins/tiddlywiki/railroad/wrapper.js b/plugins/tiddlywiki/railroad/wrapper.js index 82d89172d..a6e6d5a4d 100644 --- a/plugins/tiddlywiki/railroad/wrapper.js +++ b/plugins/tiddlywiki/railroad/wrapper.js @@ -33,6 +33,10 @@ RailroadWidget.prototype.render = function(parent,nextSibling) { this.computeAttributes(); this.execute(); // Get the source text +console.log('getAttribute(text)', this.getAttribute("text", 'not found')); +$tw.utils.each(this.parseTreeNode,function(element,title,object) { +console.log(':', element, title); +}); var source = this.getAttribute("text",this.parseTreeNode.text || ""); // Create a div to contain the SVG or error message var div = this.document.createElement("div");