How does the addition of new tiddler types work?

>From reading the railroad plugin code and the tw-dev pages on Parser and
Widget, I gather that it is as simple as creating a new parser module and
assigning the newly defined type to a specific widget.

Railroad does it in its  super-simple typed-parser.js module:
```
(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;

})();
...

The intent is clear, and the code could not be simpler. It maps the new
tiddler type text/vnd.tiddlywiki.railroad to the railroad plugin. But it
feels like a bit of magic. Where is that mapping actually established?  I
have not been able to find how it  actually implemented  in the core, and I
would like to get a better grasp of the overall mechanism. Where should I
look?

Cheers,

S.
-- 
__________________________________________________
Stefano Franchi

[email protected] <[email protected]>
http://stefano.cleinias.org

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/CAJODLwZodcay8hnXKBDK%2BJK%3DDs_X2NNfx9ZAXZeqdDDBiXvXBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to