From 112a9a95d95e9f62f110c97a4faaf537c5c100b1 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 28 Aug 2014 15:27:10 +0100 Subject: [PATCH] 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. --- core/modules/filters/prefix.js | 4 ++-- core/modules/filters/removeprefix.js | 2 +- core/modules/filters/removesuffix.js | 2 +- core/modules/filters/suffix.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/modules/filters/prefix.js b/core/modules/filters/prefix.js index 470dbfd1a..49bb8110f 100644 --- a/core/modules/filters/prefix.js +++ b/core/modules/filters/prefix.js @@ -19,13 +19,13 @@ exports.prefix = function(source,operator,options) { var results = []; if(operator.prefix === "!") { 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); } }); } else { 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); } }); diff --git a/core/modules/filters/removeprefix.js b/core/modules/filters/removeprefix.js index b7f5c5cf4..3e93dcd00 100644 --- a/core/modules/filters/removeprefix.js +++ b/core/modules/filters/removeprefix.js @@ -18,7 +18,7 @@ Export our filter function exports.removeprefix = function(source,operator,options) { var results = []; 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)); } }); diff --git a/core/modules/filters/removesuffix.js b/core/modules/filters/removesuffix.js index 4256fe49f..0dac6e598 100644 --- a/core/modules/filters/removesuffix.js +++ b/core/modules/filters/removesuffix.js @@ -18,7 +18,7 @@ Export our filter function exports.removesuffix = function(source,operator,options) { var results = []; 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)); } }); diff --git a/core/modules/filters/suffix.js b/core/modules/filters/suffix.js index 45e8900c4..a93733cc8 100644 --- a/core/modules/filters/suffix.js +++ b/core/modules/filters/suffix.js @@ -19,13 +19,13 @@ exports.suffix = function(source,operator,options) { var results = []; if(operator.prefix === "!") { 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); } }); } else { 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); } });