Skip to content

Commit

Permalink
Item15328: remove soft hyphens when wikifying a string
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed May 21, 2024
1 parent 9b3f698 commit 3d63a4c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
6 changes: 3 additions & 3 deletions JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/WIKIWORD.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ sub new {
my $this = bless(
$class->SUPER::new(
name => 'WikiWord',
version => '3.30',
version => '3.32',
author => 'Michael Daum',
homepage => 'http://foswiki.org/Extensions/JQueryPlugin',
javascript => ['wikiword.js'],
dependencies => [ 'JQUERYPLUGIN', 'FOSWIKI', 'metadata' ]
dependencies => [ 'JQUERYPLUGIN', 'FOSWIKI' ]
),
$class
);
Expand All @@ -45,7 +45,7 @@ sub new {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2010-2020 Foswiki Contributors. Foswiki Contributors
Copyright (C) 2010-2024 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
Expand Up @@ -58,5 +58,8 @@ jQuery.wikiword.downgradeMap = {

// Symbols
'©':'(c)',
'®':'(r)'
'®':'(r)',

// soft hyphen
"\xAD": ''
};
Original file line number Diff line number Diff line change
Expand Up @@ -1090,4 +1090,7 @@ jQuery.wikiword.downgradeMap = {
// Symbols
'©':'(c)',
'®':'(r)'

// soft hyphen
"\xAD": ''
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* jQuery WikiWord plugin 3.41
* jQuery WikiWord plugin 3.42
*
* Copyright (c) 2008-2021 Foswiki Contributors http://foswiki.org
* Copyright (c) 2008-2024 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 @@ -37,7 +37,7 @@ $.wikiword = {
// iterate and reformat each matched element
return this.each(function() {
var $this = $(this),
thisOpts = $.extend({}, opts, $this.data(), $this.metadata()),
thisOpts = $.extend({}, opts, $this.data()),
$source;

// either a string or a jQuery object
Expand Down Expand Up @@ -106,7 +106,7 @@ $.wikiword = {
* convert a source string to a valid WikiWord
*/
wikify: function (source, opts) {
var result = '', c, i;
var result = '', c, d, i;

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

Expand All @@ -122,7 +122,8 @@ $.wikiword = {
if (opts.transliterate) {
for (i = 0; i < source.length; i++) {
c = source[i];
result += $.wikiword.downgradeMap[c] || c;
d = $.wikiword.downgradeMap[c];
result += typeof(d) === 'undefined' ? c : d;
}
} else {
result = source;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* jQuery WikiWord plugin 3.41
* jQuery WikiWord plugin 3.42
*
* Copyright (c) 2008-2021 Foswiki Contributors http://foswiki.org
* Copyright (c) 2008-2024 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 @@ -37,7 +37,7 @@ $.wikiword = {
// iterate and reformat each matched element
return this.each(function() {
var $this = $(this),
thisOpts = $.extend({}, opts, $this.data(), $this.metadata()),
thisOpts = $.extend({}, opts, $this.data()),
$source;

// either a string or a jQuery object
Expand Down Expand Up @@ -106,7 +106,7 @@ $.wikiword = {
* convert a source string to a valid WikiWord
*/
wikify: function (source, opts) {
var result = '', c, i;
var result = '', c, d, i;

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

Expand All @@ -122,7 +122,8 @@ $.wikiword = {
if (opts.transliterate) {
for (i = 0; i < source.length; i++) {
c = source[i];
result += $.wikiword.downgradeMap[c] || c;
d = $.wikiword.downgradeMap[c];
result += typeof(d) === 'undefined' ? c : d;
}
} else {
result = source;
Expand Down Expand Up @@ -231,5 +232,8 @@ jQuery.wikiword.downgradeMap = {

// Symbols
'©':'(c)',
'®':'(r)'
'®':'(r)',

// soft hyphen
"\xAD": ''
};

0 comments on commit 3d63a4c

Please sign in to comment.