1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 02:19:55 +00:00

Introduce text/vnd.tiddlywiki.railroad

This commit is contained in:
Astrid Elocson 2015-01-19 19:59:38 +00:00
parent 6842a354ea
commit e5676d058a
2 changed files with 32 additions and 0 deletions

View File

@ -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;
})();

View File

@ -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");