mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-07-05 19:42:51 +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
|
title: $:/core/modules/parsers/newwikitextparser/blockrules/class.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: wikirule
|
module-type: wikitextrule
|
||||||
|
|
||||||
Wiki text block rule for assigning classes to paragraphs and other blocks
|
Wiki text block rule for assigning classes to paragraphs and other blocks
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/parsers/newwikitextparser/blockrules/heading.js
|
title: $:/core/modules/parsers/newwikitextparser/blockrules/heading.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: wikirule
|
module-type: wikitextrule
|
||||||
|
|
||||||
Wiki text block rule for headings
|
Wiki text block rule for headings
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/parsers/newwikitextparser/blockrules/html.js
|
title: $:/core/modules/parsers/newwikitextparser/blockrules/html.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: wikirule
|
module-type: wikitextrule
|
||||||
|
|
||||||
Wiki text block rule for block level HTML elements
|
Wiki text block rule for block level HTML elements
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/parsers/newwikitextparser/blockrules/list.js
|
title: $:/core/modules/parsers/newwikitextparser/blockrules/list.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: wikirule
|
module-type: wikitextrule
|
||||||
|
|
||||||
Wiki text block rule for lists.
|
Wiki text block rule for lists.
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/parsers/newwikitextparser/blockrules/rule.js
|
title: $:/core/modules/parsers/newwikitextparser/blockrules/rule.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: wikirule
|
module-type: wikitextrule
|
||||||
|
|
||||||
Wiki text block rule for rules
|
Wiki text block rule for rules
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ var WikiTextParser = function(options) {
|
|||||||
this.runRules = [];
|
this.runRules = [];
|
||||||
var blockRegExpStrings = [],
|
var blockRegExpStrings = [],
|
||||||
runRegExpStrings = [],
|
runRegExpStrings = [],
|
||||||
rules = ($tw.plugins.moduleTypes.wikirule || []).slice(0);
|
rules = ($tw.plugins.moduleTypes.wikitextrule || []).slice(0);
|
||||||
for(var t=0; t<rules.length; t++) {
|
for(var t=0; t<rules.length; t++) {
|
||||||
if(rules[t].blockParser) {
|
if(rules[t].blockParser) {
|
||||||
this.blockRules.push(rules[t]);
|
this.blockRules.push(rules[t]);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/parsers/newwikitextparser/runrules/macro.js
|
title: $:/core/modules/parsers/newwikitextparser/runrules/macro.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: wikirule
|
module-type: wikitextrule
|
||||||
|
|
||||||
Wiki text run rule for pretty links
|
Wiki text run rule for pretty links
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/parsers/newwikitextparser/runrules/prettylink.js
|
title: $:/core/modules/parsers/newwikitextparser/runrules/prettylink.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: wikirule
|
module-type: wikitextrule
|
||||||
|
|
||||||
Wiki text run rule for pretty links
|
Wiki text run rule for pretty links
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/parsers/newwikitextparser/runrules/wikilink.js
|
title: $:/core/modules/parsers/newwikitextparser/runrules/wikilink.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: wikirule
|
module-type: wikitextrule
|
||||||
|
|
||||||
Wiki text run rule for wiki links.
|
Wiki text run rule for wiki links.
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/parsers/wikitextparser/rules/wikitextrules.js
|
title: $:/core/modules/parsers/wikitextparser/rules/wikitextrules.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: wikitextrule
|
module-type: module
|
||||||
|
|
||||||
Rule modules for the wikitext parser
|
Rule modules for the wikitext parser
|
||||||
|
|
||||||
|
@ -53,8 +53,9 @@ var WikiTextParser = function(options) {
|
|||||||
this.autoLinkWikiWords = true;
|
this.autoLinkWikiWords = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
WikiTextParser.prototype.installRules = function(rules) {
|
WikiTextParser.prototype.installRules = function() {
|
||||||
var pattern = [];
|
var rules = require("./rules/wikitextrules.js").rules,
|
||||||
|
pattern = [];
|
||||||
for(var n=0; n<rules.length; n++) {
|
for(var n=0; n<rules.length; n++) {
|
||||||
pattern.push("(" + rules[n].match + ")");
|
pattern.push("(" + rules[n].match + ")");
|
||||||
}
|
}
|
||||||
|
@ -247,15 +247,10 @@ exports.initParsers = function(moduleType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Install the wikitext rules
|
// Install the rules for the old wikitext parser rules
|
||||||
modules = $tw.plugins.moduleTypes.wikitextrule;
|
|
||||||
var wikitextparser = this.parsers["text/x-tiddlywiki"];
|
var wikitextparser = this.parsers["text/x-tiddlywiki"];
|
||||||
if(modules && wikitextparser) {
|
if(modules && wikitextparser) {
|
||||||
for(n=0; n<modules.length; n++) {
|
wikitextparser.installRules();
|
||||||
m = modules[n];
|
|
||||||
// Add the rules defined by the module - currently a hack as we overwrite them
|
|
||||||
wikitextparser.installRules(m.rules);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user