1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-24 02:27:19 +00:00

Make prefix/suffix operators be case sensitive

I think it was a mistake for them to be case insensitive in the first
place.

https://groups.google.com/d/topic/tiddlywiki/dzpFsRCC5D8/discussion

If case insensitivity is required then regexps can be used instead.
This commit is contained in:
Jermolene 2014-08-28 15:27:10 +01:00
parent 748caecca0
commit 112a9a95d9
4 changed files with 6 additions and 6 deletions

View File

@ -19,13 +19,13 @@ exports.prefix = function(source,operator,options) {
var results = []; var results = [];
if(operator.prefix === "!") { if(operator.prefix === "!") {
source(function(tiddler,title) { source(function(tiddler,title) {
if(title.substr(0,operator.operand.length).toLowerCase() !== operator.operand.toLowerCase()) { if(title.substr(0,operator.operand.length) !== operator.operand) {
results.push(title); results.push(title);
} }
}); });
} else { } else {
source(function(tiddler,title) { source(function(tiddler,title) {
if(title.substr(0,operator.operand.length).toLowerCase() === operator.operand.toLowerCase()) { if(title.substr(0,operator.operand.length) === operator.operand) {
results.push(title); results.push(title);
} }
}); });

View File

@ -18,7 +18,7 @@ Export our filter function
exports.removeprefix = function(source,operator,options) { exports.removeprefix = function(source,operator,options) {
var results = []; var results = [];
source(function(tiddler,title) { source(function(tiddler,title) {
if(title.substr(0,operator.operand.length).toLowerCase() === operator.operand.toLowerCase()) { if(title.substr(0,operator.operand.length) === operator.operand) {
results.push(title.substr(operator.operand.length)); results.push(title.substr(operator.operand.length));
} }
}); });

View File

@ -18,7 +18,7 @@ Export our filter function
exports.removesuffix = function(source,operator,options) { exports.removesuffix = function(source,operator,options) {
var results = []; var results = [];
source(function(tiddler,title) { source(function(tiddler,title) {
if(title.substr(-operator.operand.length).toLowerCase() === operator.operand.toLowerCase()) { if(title.substr(-operator.operand.length) === operator.operand) {
results.push(title.substr(0,title.length - operator.operand.length)); results.push(title.substr(0,title.length - operator.operand.length));
} }
}); });

View File

@ -19,13 +19,13 @@ exports.suffix = function(source,operator,options) {
var results = []; var results = [];
if(operator.prefix === "!") { if(operator.prefix === "!") {
source(function(tiddler,title) { source(function(tiddler,title) {
if(title.substr(-operator.operand.length).toLowerCase() !== operator.operand.toLowerCase()) { if(title.substr(-operator.operand.length) !== operator.operand) {
results.push(title); results.push(title);
} }
}); });
} else { } else {
source(function(tiddler,title) { source(function(tiddler,title) {
if(title.substr(-operator.operand.length).toLowerCase() === operator.operand.toLowerCase()) { if(title.substr(-operator.operand.length) === operator.operand) {
results.push(title); results.push(title);
} }
}); });