mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-19 22:26:18 +00:00
![Jermolene](/assets/img/avatar_default.png)
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.
29 lines
631 B
JavaScript
29 lines
631 B
JavaScript
/*\
|
|
title: $:/core/modules/filters/removeprefix.js
|
|
type: application/javascript
|
|
module-type: filteroperator
|
|
|
|
Filter operator for removing a prefix from each title in the list. Titles that do not start with the prefix are removed.
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
/*
|
|
Export our filter function
|
|
*/
|
|
exports.removeprefix = function(source,operator,options) {
|
|
var results = [];
|
|
source(function(tiddler,title) {
|
|
if(title.substr(0,operator.operand.length) === operator.operand) {
|
|
results.push(title.substr(operator.operand.length));
|
|
}
|
|
});
|
|
return results;
|
|
};
|
|
|
|
})();
|