Skip to content

Commit

Permalink
Item12933: fixed api when calling $.wikiword.wikify() without options
Browse files Browse the repository at this point in the history
... a newly introduced error



git-svn-id: http://svn.foswiki.org/trunk@17791 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Jun 27, 2014
1 parent 1cb390c commit f92b1d4
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ $.wikiword = {
thisOpts = $.meta ? $.extend({}, opts, $this.data()) : opts;

// generate RegExp for filtered chars
thisOpts.allowedRegex = new RegExp('['+thisOpts.allow+']+', "g");
thisOpts.forbiddenRegex = new RegExp('[^'+thisOpts.allow+']+', "g");
if (typeof(thisOpts.allow) !== 'undefined') {
thisOpts.allowedRegex = new RegExp('['+thisOpts.allow+']+', "g");
thisOpts.forbiddenRegex = new RegExp('[^'+thisOpts.allow+']+', "g");
}

$source.change(function() {
$.wikiword.handleChange($source, $this, thisOpts);
Expand Down Expand Up @@ -141,6 +143,8 @@ $.wikiword = {

var result = '', c, i;

opts = opts || $.wikiword.defaults;

// transliterate unicode chars
for (i = 0; i < source.length; i++) {
c = source[i];
Expand Down Expand Up @@ -168,7 +172,8 @@ $.wikiword = {
suffix: '',
prefix: '',
initial: '',
allow: 'a-zA-Z\\d'
allowedRegex: new RegExp('[a-zA-Z\\d]+', "g"),
forbiddenRegex: new RegExp('[^a-zA-Z\\d]+', "g")
}
};

Expand Down

0 comments on commit f92b1d4

Please sign in to comment.