Skip to content

Commit

Permalink
Item14636: fixed javascript api of jquery.wikiword
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Feb 23, 2018
1 parent d647707 commit 35945c1
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 46 deletions.
3 changes: 2 additions & 1 deletion JQueryPlugin/data/System/JQueryPlugin.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1513634809" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1519374726" format="1.1" version="1"}%
---+!! %TOPIC%
%FORMFIELD{"Description"}%

Expand Down Expand Up @@ -125,6 +125,7 @@ required for Foswiki 1.1 or later.

---++ Change History
%TABLE{columnwidths="7em" tablewidth="100%"}%
| 23 Feb 2018: | (8.01) - Item14636: fixed javascript api for jquery.wikiword |
| 11 Dec 2017: | (8.00) - Item14564: added jquery-3 and the matching migrate module <br /> \
Item14567: added keyboard navigation to jquery.stars <br /> \
Item14568: added chili recipes for autolisp and ini <br /> \
Expand Down
4 changes: 2 additions & 2 deletions JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ BEGIN {
}
}

our $VERSION = '8.00';
our $RELEASE = '11 Dec 2017';
our $VERSION = '8.01';
our $RELEASE = '23 Feb 2018';
our $SHORTDESCRIPTION = 'jQuery <nop>JavaScript library for Foswiki';
our $NO_PREFS_IN_TOPIC = 1;

Expand Down
3 changes: 0 additions & 3 deletions JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -961,9 +961,6 @@ pub/System/JQueryPlugin/plugins/validate/localization/messages_zh_TW.js 0644
pub/System/JQueryPlugin/plugins/validate/localization/methods_de.js 0644
pub/System/JQueryPlugin/plugins/validate/localization/methods_nl.js 0644
pub/System/JQueryPlugin/plugins/validate/localization/methods_pt.js 0644
pub/System/JQueryPlugin/plugins/validate/pkg.js 0644
pub/System/JQueryPlugin/plugins/validate/pkg.js.gz 0644
pub/System/JQueryPlugin/plugins/validate/pkg.uncompressed.js 0644
pub/System/JQueryPlugin/plugins/validate/Makefile 0644
pub/System/JQueryPlugin/plugins/validate/pkg.js 0644
pub/System/JQueryPlugin/plugins/validate/pkg.js.gz 0644
Expand Down
4 changes: 2 additions & 2 deletions JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/WIKIWORD.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sub new {
my $this = bless(
$class->SUPER::new(
name => 'WikiWord',
version => '3.21',
version => '3.30',
author => 'Michael Daum',
homepage => 'http://foswiki.org/Extensions/JQueryPlugin',
javascript => ['wikiword.js'],
Expand All @@ -46,7 +46,7 @@ sub new {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2010-2016 Foswiki Contributors. Foswiki Contributors
Copyright (C) 2010-2018 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* jQuery WikiWord plugin 3.21
* jQuery WikiWord plugin 3.30
*
* Copyright (c) 2008-2017 Foswiki Contributors http://foswiki.org
* Copyright (c) 2008-2018 Foswiki Contributors http://foswiki.org
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
Expand Down Expand Up @@ -52,14 +52,6 @@ $.wikiword = {
$source = thisOpts.source;
}

// generate RegExp for filtered chars
if (typeof(thisOpts.allowedRegex) === 'string') {
thisOpts.allowedRegex = new RegExp(thisOpts.allowedRegex, "g");
}
if (typeof(thisOpts.forbiddenRegex) === 'string') {
thisOpts.forbiddenRegex = new RegExp(thisOpts.forbiddenRegex, "g");
}

$source.on("change", function() {
$.wikiword.handleChange($source, $this, thisOpts);
}).keyup(function() {
Expand All @@ -82,13 +74,6 @@ $.wikiword = {

if (result || !opts.initial) {
result = $.wikiword.wikify(result, opts);

if (opts.suffix && result.indexOf(opts.suffix, result.length - opts.suffix.length) === -1) {
result += opts.suffix;
}
if (opts.prefix && result.indexOf(opts.prefix) !== 0) {
result = opts.prefix+result;
}
} else {
result = opts.initial;
}
Expand All @@ -106,10 +91,17 @@ $.wikiword = {
* convert a source string to a valid WikiWord
*/
wikify: function (source, opts) {

var result = '', c, i;

opts = opts || $.wikiword.defaults;
opts = $.extend({}, $.wikiword.defaults, opts);

// generate RegExp for filtered chars
if (typeof(opts.allowedRegex) === 'string') {
opts.allowedRegex = new RegExp(opts.allowedRegex, "g");
}
if (typeof(opts.forbiddenRegex) === 'string') {
opts.forbiddenRegex = new RegExp(opts.forbiddenRegex, "g");
}

// transliterate unicode chars
if (opts.transliterate) {
Expand All @@ -129,6 +121,13 @@ $.wikiword = {
// remove all forbidden chars
result = result.replace(opts.forbiddenRegex, "");

if (opts.suffix && result.indexOf(opts.suffix, result.length - opts.suffix.length) === -1) {
result += opts.suffix;
}
if (opts.prefix && result.indexOf(opts.prefix) !== 0) {
result = opts.prefix+result;
}

return result;
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* jQuery WikiWord plugin 3.21
* jQuery WikiWord plugin 3.30
*
* Copyright (c) 2008-2017 Foswiki Contributors http://foswiki.org
* Copyright (c) 2008-2018 Foswiki Contributors http://foswiki.org
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
Expand Down Expand Up @@ -52,14 +52,6 @@ $.wikiword = {
$source = thisOpts.source;
}

// generate RegExp for filtered chars
if (typeof(thisOpts.allowedRegex) === 'string') {
thisOpts.allowedRegex = new RegExp(thisOpts.allowedRegex, "g");
}
if (typeof(thisOpts.forbiddenRegex) === 'string') {
thisOpts.forbiddenRegex = new RegExp(thisOpts.forbiddenRegex, "g");
}

$source.on("change", function() {
$.wikiword.handleChange($source, $this, thisOpts);
}).keyup(function() {
Expand All @@ -82,13 +74,6 @@ $.wikiword = {

if (result || !opts.initial) {
result = $.wikiword.wikify(result, opts);

if (opts.suffix && result.indexOf(opts.suffix, result.length - opts.suffix.length) === -1) {
result += opts.suffix;
}
if (opts.prefix && result.indexOf(opts.prefix) !== 0) {
result = opts.prefix+result;
}
} else {
result = opts.initial;
}
Expand All @@ -106,10 +91,17 @@ $.wikiword = {
* convert a source string to a valid WikiWord
*/
wikify: function (source, opts) {

var result = '', c, i;

opts = opts || $.wikiword.defaults;
opts = $.extend({}, $.wikiword.defaults, opts);

// generate RegExp for filtered chars
if (typeof(opts.allowedRegex) === 'string') {
opts.allowedRegex = new RegExp(opts.allowedRegex, "g");
}
if (typeof(opts.forbiddenRegex) === 'string') {
opts.forbiddenRegex = new RegExp(opts.forbiddenRegex, "g");
}

// transliterate unicode chars
if (opts.transliterate) {
Expand All @@ -129,6 +121,13 @@ $.wikiword = {
// remove all forbidden chars
result = result.replace(opts.forbiddenRegex, "");

if (opts.suffix && result.indexOf(opts.suffix, result.length - opts.suffix.length) === -1) {
result += opts.suffix;
}
if (opts.prefix && result.indexOf(opts.prefix) !== 0) {
result = opts.prefix+result;
}

return result;
},

Expand Down

0 comments on commit 35945c1

Please sign in to comment.