1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Switch to using the 'wikitextrule' moduletype for the new wiki text parser

This commit is contained in:
Jeremy Ruston 2012-05-27 09:19:37 +01:00
parent 5738d146e0
commit 506519b49a
12 changed files with 15 additions and 19 deletions

View File

@ -1,7 +1,7 @@
/*\
title: $:/core/modules/parsers/newwikitextparser/blockrules/class.js
type: application/javascript
module-type: wikirule
module-type: wikitextrule
Wiki text block rule for assigning classes to paragraphs and other blocks

View File

@ -1,7 +1,7 @@
/*\
title: $:/core/modules/parsers/newwikitextparser/blockrules/heading.js
type: application/javascript
module-type: wikirule
module-type: wikitextrule
Wiki text block rule for headings

View File

@ -1,7 +1,7 @@
/*\
title: $:/core/modules/parsers/newwikitextparser/blockrules/html.js
type: application/javascript
module-type: wikirule
module-type: wikitextrule
Wiki text block rule for block level HTML elements

View File

@ -1,7 +1,7 @@
/*\
title: $:/core/modules/parsers/newwikitextparser/blockrules/list.js
type: application/javascript
module-type: wikirule
module-type: wikitextrule
Wiki text block rule for lists.

View File

@ -1,7 +1,7 @@
/*\
title: $:/core/modules/parsers/newwikitextparser/blockrules/rule.js
type: application/javascript
module-type: wikirule
module-type: wikitextrule
Wiki text block rule for rules

View File

@ -155,7 +155,7 @@ var WikiTextParser = function(options) {
this.runRules = [];
var blockRegExpStrings = [],
runRegExpStrings = [],
rules = ($tw.plugins.moduleTypes.wikirule || []).slice(0);
rules = ($tw.plugins.moduleTypes.wikitextrule || []).slice(0);
for(var t=0; t<rules.length; t++) {
if(rules[t].blockParser) {
this.blockRules.push(rules[t]);

View File

@ -1,7 +1,7 @@
/*\
title: $:/core/modules/parsers/newwikitextparser/runrules/macro.js
type: application/javascript
module-type: wikirule
module-type: wikitextrule
Wiki text run rule for pretty links

View File

@ -1,7 +1,7 @@
/*\
title: $:/core/modules/parsers/newwikitextparser/runrules/prettylink.js
type: application/javascript
module-type: wikirule
module-type: wikitextrule
Wiki text run rule for pretty links

View File

@ -1,7 +1,7 @@
/*\
title: $:/core/modules/parsers/newwikitextparser/runrules/wikilink.js
type: application/javascript
module-type: wikirule
module-type: wikitextrule
Wiki text run rule for wiki links.

View File

@ -1,7 +1,7 @@
/*\
title: $:/core/modules/parsers/wikitextparser/rules/wikitextrules.js
type: application/javascript
module-type: wikitextrule
module-type: module
Rule modules for the wikitext parser

View File

@ -53,8 +53,9 @@ var WikiTextParser = function(options) {
this.autoLinkWikiWords = true;
};
WikiTextParser.prototype.installRules = function(rules) {
var pattern = [];
WikiTextParser.prototype.installRules = function() {
var rules = require("./rules/wikitextrules.js").rules,
pattern = [];
for(var n=0; n<rules.length; n++) {
pattern.push("(" + rules[n].match + ")");
}

View File

@ -247,15 +247,10 @@ exports.initParsers = function(moduleType) {
}
}
}
// Install the wikitext rules
modules = $tw.plugins.moduleTypes.wikitextrule;
// Install the rules for the old wikitext parser rules
var wikitextparser = this.parsers["text/x-tiddlywiki"];
if(modules && wikitextparser) {
for(n=0; n<modules.length; n++) {
m = modules[n];
// Add the rules defined by the module - currently a hack as we overwrite them
wikitextparser.installRules(m.rules);
}
wikitextparser.installRules();
}
};