mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-05-25 02:34:07 +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.computeAttributes();
|
||||||
this.execute();
|
this.execute();
|
||||||
// Get the source text
|
// 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 || "");
|
var source = this.getAttribute("text",this.parseTreeNode.text || "");
|
||||||
// Create a div to contain the SVG or error message
|
// Create a div to contain the SVG or error message
|
||||||
var div = this.document.createElement("div");
|
var div = this.document.createElement("div");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user