mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-28 02:50:27 +00:00
Introduce text/vnd.tiddlywiki.railroad
This commit is contained in:
parent
6842a354ea
commit
e5676d058a
28
plugins/tiddlywiki/railroad/tw-parser.js
Normal file
28
plugins/tiddlywiki/railroad/tw-parser.js
Normal 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;
|
||||
|
||||
})();
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user