mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 03:43:45 +08:00
Don't raise an error for global regexps; warn the plugin author instead.
This commit is contained in:
parent
60578afefd
commit
0044a99000
|
@ -1,4 +1,4 @@
|
||||||
/*global Markdown:true */
|
/*global Markdown, console */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Contains methods to help us with markdown formatting.
|
Contains methods to help us with markdown formatting.
|
||||||
|
@ -83,7 +83,13 @@ function anchorRegexp(regex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var flags = "";
|
var flags = "";
|
||||||
if (regex.global) { throw "Invalid attribute validation regex - cannot be global"; }
|
if (regex.global) {
|
||||||
|
flags += "g";
|
||||||
|
if (typeof console !== 'undefined') {
|
||||||
|
console.warn("attribute validation regex should not be global");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (regex.ignoreCase) { flags += "i"; }
|
if (regex.ignoreCase) { flags += "i"; }
|
||||||
if (regex.multiline) { flags += "m"; }
|
if (regex.multiline) { flags += "m"; }
|
||||||
if (regex.sticky) { throw "Invalid attribute validation regex - cannot be sticky"; }
|
if (regex.sticky) { throw "Invalid attribute validation regex - cannot be sticky"; }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user