mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-25 17:40:29 +00:00
d338a54370
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...
33 lines
908 B
JavaScript
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;
|
|
|
|
})();
|
|
|