1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-07 22:33:50 +00:00

Refactored formatters out of global config object

This commit is contained in:
Jeremy Ruston 2011-12-03 16:32:29 +00:00
parent e1f26eb07b
commit f33880f506

View File

@ -7,14 +7,12 @@ var Tiddler = require("./Tiddler.js").Tiddler,
util = require("util"); util = require("util");
function Formatter(formatters) function Formatter()
{ {
var n;
this.formatters = [];
var pattern = []; var pattern = [];
for(n=0; n<formatters.length; n++) { this.formatters = Formatter.formatters;
pattern.push("(" + formatters[n].match + ")"); for(var n=0; n<this.formatters.length; n++) {
this.formatters.push(formatters[n]); pattern.push("(" + this.formatters[n].match + ")");
} }
this.formatterRegExp = new RegExp(pattern.join("|"),"mg"); this.formatterRegExp = new RegExp(pattern.join("|"),"mg");
} }
@ -88,7 +86,7 @@ Formatter.isExternalLink = function(link) {
return false; return false;
}; };
config.formatters = [ Formatter.formatters = [
{ {
name: "table", name: "table",
match: "^\\|(?:[^\\n]*)\\|(?:[fhck]?)$", match: "^\\|(?:[^\\n]*)\\|(?:[fhck]?)$",