1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-13 07:49:42 +00:00
TiddlyWiki5/core/modules/wikivocabulary.js
Jeremy Ruston d338a54370 Introduce refactored wiki parser and renderer
This is a half-way through a big refactoring of the parsing and
rendering infrastructure. The main change is to separate the parse and
render trees, which makes the code a lot cleaner. The new parser isn't
yet functional enough to replace the existing parser so for the moment
you have to manually invoke it with `$tw.testNewParser()` in your
browser console. I really ought to use branches for this kind of
thing...
2012-12-13 21:34:31 +00:00

33 lines
908 B
JavaScript

/*\
title: $:/core/modules/parsers/wikiparser/wikivocabulary.js
type: application/javascript
module-type: global
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var WikiVocabulary = function(options) {
this.wiki = options.wiki;
// Hashmaps of the various parse rule classes
this.pragmaRuleClasses = $tw.modules.applyMethods("wikipragmarule");
this.blockRuleClasses = $tw.modules.applyMethods("wikiblockrule");
this.runRuleClasses = $tw.modules.applyMethods("wikirunrule");
// Hashmap of the various renderer classes
this.rendererClasses = $tw.modules.applyMethods("wikirenderer");
// Hashmap of the available widgets
this.widgetClasses = $tw.modules.applyMethods("widget");
};
WikiVocabulary.prototype.parseText = function(type,text) {
return new $tw.WikiParser(this,type,text,{wiki: this.wiki});
};
exports.WikiVocabulary = WikiVocabulary;
})();