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.
print-window-tiddler
Jermolene 2014-08-28 15:27:10 +01:00
rodzic 748caecca0
commit 112a9a95d9
4 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -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);
}
});

Wyświetl plik

@ -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));
}
});

Wyświetl plik

@ -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));
}
});

Wyświetl plik

@ -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);
}
});