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:
parent
5738d146e0
commit
506519b49a
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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]);
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 + ")");
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user